Преглед изворни кода

Round 84 polish after snapshots; MP3 from the command-line export; LAME in THIRD_PARTY; docs

Ka1-S пре 1 месец
родитељ
комит
4d073fa99f

+ 1 - 0
THIRD_PARTY.md

@@ -8,6 +8,7 @@ LYNX is distributed under the [GNU AGPL-3.0](LICENSE). It uses the components be
 | [CLAP](https://github.com/free-audio/clap) (headers in `third_party/clap`) | CLAP plugin hosting | MIT |
 | [WavPack](https://www.wavpack.com) (decoder in `third_party/wavpack`) | reading `.wv` samples | 3-clause BSD (`third_party/wavpack/COPYING`) |
 | [libogg 1.3.5 and libvorbis 1.3.7](https://xiph.org/vorbis/) (decoder in `third_party/vorbis`; `src/mdct.c` modified, see the "LYNX modification" comment) | decoding Ogg Vorbis samples the way FL Studio does | 3-clause BSD (`third_party/vorbis/COPYING.libogg`, `third_party/vorbis/COPYING.libvorbis`) |
+| [LAME 3.100](https://lame.sourceforge.io) (`libmp3lame` encoder sources in `third_party/lame`, unmodified; `src/config.h` written for LYNX's build) | MP3 export | LGPL-2.0-or-later (`third_party/lame/COPYING`) |
 | [VST 3 SDK](https://github.com/steinbergmedia/vst3sdk) (the copy bundled with JUCE 8.0.4) | VST3 plugin hosting | GPLv3 option of Steinberg's dual licence (`VST3_SDK/LICENSE.txt` in JUCE) |
 | [ASIO SDK 2.3.4](https://www.steinberg.net/developers/) (interface headers in `third_party/asiosdk`) | ASIO audio drivers on Windows | GPLv3 option of Steinberg's dual licence (`third_party/asiosdk/LICENSE.txt`) |
 | Libraries bundled inside JUCE's modules | text shaping, image and audio codecs, zip | HarfBuzz (MIT), SheenBidi (Apache-2.0), FLAC (BSD-3-Clause), Ogg/Vorbis (BSD-3-Clause), libpng (libpng/zlib licence), IJG libjpeg (IJG licence), zlib (zlib licence) |

+ 78 - 1
docs/analise/REA_rodada84.md

@@ -34,6 +34,83 @@ behaviour a user sees; LYNX's windows are its own layout in its own style (dark,
   columns), show note labels, velocity, scroll lock, root note, key size (extra small … extra large), keyboard
   height (full / half / quarter), presets.
 
+## 2. What LYNX does now
+
+### Export window (`src/ui/ExportDialog.cpp`, core `src/core/ExportOptions.*`, engine `src/engine/Exporter.*`)
+- Left column "What to render": range Song (Playlist) / Current pattern / Playlist selection (the time selection =
+  the loop region; clips crossing its edges are cut there, offsets follow), how many times it plays (1–16; the clips
+  are repeated in the render copy, so releases and effects carry over from one pass into the next), tail Cut / Leave /
+  Wrap remainder (wrap: the rendered tail is added back from the start, wrapping more than once if longer than the
+  loop, then the file is cut to the exact length), longest tail 3/6/12/30 s, files: one (the mix) / one per mixer
+  insert / one per channel (each channel alone through its own mixer path), "Also the full mix".
+- Right column "Output format": WAV / MP3 / OGG / FLAC. WAV 16 / 24 integer or 32 float; MP3 96–320 kbps CBR
+  (LAME, joint stereo, ID3v2 title/artist when ASCII; project rates above 48 kHz are encoded at 48 / 44.1 kHz by LAME's
+  resampler); OGG 64–500 kbps (JUCE's Vorbis encoder settings); FLAC 16 / 24 bits, compression 0–8. Sample rate
+  44.1–192 kHz, channels stereo / mono mixed / left / right, dither off / TPDF / TPDF + noise shaping (16 and 24-bit
+  integer output only).
+- Mix: normalize (peak to 0 dBFS, measured on what is kept after the tail step), Master effects on/off, trim the PDC
+  silence. A status line shows the total time (+ tail), the MP3 rate actually used, the stem count, and warnings
+  (Master muted, no selection). Choices are remembered in `%APPDATA%\LYNX\export-settings.txt`.
+- Engine: when nothing needs the whole file first (WAV/FLAC/OGG, stereo, no normalize, tail "leave") the export
+  streams into the writer exactly as before (the command line, self-test, FL comparisons and "Render to audio" use
+  `ExportSettings`, which maps to these options with the old behaviour, dither only for 16-bit WAV). Otherwise
+  `renderOffline` hands every block to a capture callback, then tail → normalize → mono → dither (same 512-sample
+  block order) → writer or MP3 encoder.
+- `Dither` gained a no-shaping mode (plain TPDF).
+
+### MP3 encoder (`src/core/Mp3Encoder.*`, `third_party/lame`)
+LAME 3.100's `libmp3lame` (LGPL-2.0-or-later, unmodified sources, encoder only, `src/config.h` written for LYNX), built
+by build-local.sh, build-windows-zig.sh and CMake (`lame_encoder`). `scanMp3` parses frame headers for the tests.
+
+### New project window (`src/ui/NewProjectDialog.*`, core in `src/core/Templates.*`)
+Templates: LYNX's default song, the built-in ones (Empty, Basic beat, Trap with 808, House) and the user's `.lynx`
+files in `Documents\LYNX\Templates` (File › Save as template... writes there; "Open the templates folder").
+Name, folder (Choose...), "Save it there now", "Create a folder for the project" (path preview), tempo and time
+signature (follow the template until changed), title / author / genre / web link, "Don't show this window for File ›
+New" (then File › New makes the default project at once; File › New project... always opens the window). The last
+folder, author and choices are remembered (`%APPDATA%\LYNX\new-project.txt`). FL's PPQ choice is not offered (LYNX has
+one internal timebase).
+
+### Clip properties (`src/ui/ClipProperties.*`, core `src/core/PlaylistOps.*`)
+Clip menu › Properties...: the source's name and colour (pattern / audio channel / automation; they change every
+clip of that source), which source the clip uses, track, start / length / offset as bar:beat:tick text, muted; audio
+clips: gain (dB), fades (beats), the channel's pitch and stretch-to-beats with keep-pitch. Several clips selected:
+mute (don't change / mute all / unmute all / flip) and gain (set / change by) for all of them. Reset puts the clip back
+as it was when the window opened. Every change is one undo step; the window follows undo and closes if its clip
+disappears.
+
+### Arrangements (`showArrangements`, Playlist arrangement menu › Arrangements and merging...)
+List with clip count and length; Show (make current), New, Duplicate, Rename..., Remove, Move up/down. Merge into
+the current arrangement: source, mode Insert (clips crossing the position are split, everything after it and the
+markers move later by the source's length) / Merge (laid over) / Replace (the source's length is cleared first,
+crossing clips cut), position Start / Playback position / End (next bar line after the last clip).
+
+### Plugin performance monitor (`src/ui/PluginMonitorWindow.*`, core `src/core/PluginMonitor.*`)
+`RackRenderer` now times each channel's instrument and each effect slot (`ProcessTimes`, relaxed atomics,
+steady_clock; only while the window is open, otherwise one relaxed load per block). The window shows, per instrument
+and effect, now / average / peak as a share of real time (100% = one core for the audio's duration), the whole rack's
+load, Find, Plugins only, Freeze, Reset on play, Reset, sortable columns.
+
+### Touch keyboard (`src/ui/TouchKeyboard.*`, core `src/core/TouchKeyboard.h`)
+View › Touch keyboard: plays the selected channel (records like the typing piano). Velocity from where the key is
+touched (0.2 at the top → 1.0 at the bottom, square-root curve) or fixed; multi-touch (one HeldNotes tag per pointer);
+dragging glides key to key (the old note stops first); octave − / + (keeps every key inside 0–127, lowest key a C),
+small / medium / large keys (35 / 28 / 21 white keys), note names. No stuck notes: every note goes through HeldNotes
+and is stopped on mouse up, on leaving the keys, on focus loss, when the window hides or closes, when the selected
+channel changes and before an octave shift or key-size change.
+
+## 3. Tests (`tests/DialogsTests84.inc`)
+Options text round trip and clamping; render song for song / pattern / selection (edge cuts), loops, tail, master
+effects; tail cut / leave / wrap (multi-wrap, padding), normalize gain, mono; stems (tracks, channels, muted clips,
+file names); plain TPDF dither; MP3 frames (44.1 kHz stereo 320 kbps, 48 kHz mono 128 kbps, 96 → 48 kHz); monitor
+sources, loads, smoothing, averages, reset, find, slot reuse; clip properties read / apply / clamps / groups;
+bar:beat:tick text; arrangement insert / merge / replace / clear range / move / rename / duplicate; new project path
+and setup; touch keyboard geometry, velocity, octave clamp and note-on/off balance through HeldNotes.
+
 ## Where I stopped / next steps
 
-- (in progress)
+- (in progress) builds and snapshots.
+- Not done: FL's export of several formats at once, MIDI export from the render window, "HQ for all plugins" /
+  resampling quality / polyphony switches, markers and tempo in the WAV file; New project PPQ (LYNX has one
+  timebase), "copy used samples to the project folder"; Clip properties pan (LYNX clips have no pan) and per-clip
+  pitch (it is the audio channel's); Touch keyboard pads mode and presets.

+ 10 - 8
docs/analise/UI_windows_inventory.md

@@ -36,9 +36,9 @@ window); **missing** = nothing yet; **n/a** = not applicable to LYNX.
 | TBrowserForm "FL Studio Browser", TSampleListForm "Browser" | browser | exists | BrowserComponent |
 | TPluginForm | plugin wrapper window | exists | PluginWindow (+ LYNX's own editors) |
 | TFLHintBarForm | hint bar | exists | HintBar |
-| TToolbarForm / TTouchKeybForm "Touch keyboard" | on-screen keyboard | missing | typing keyboard as piano exists, no on-screen keys |
+| TToolbarForm / TTouchKeybForm "Touch keyboard" | on-screen keyboard | **exists (round 84)** | View › Touch keyboard: velocity by touch position or fixed, multi-touch, glide, octave shift, key sizes; no pads mode |
 | TPythonForm "Script output" | Python scripting console | n/a | LYNX has no scripting |
-| TPluginMonitorForm "Plugin performance monitor" | CPU per plugin | missing | |
+| TPluginMonitorForm "Plugin performance monitor" | CPU per plugin | **exists (round 84)** | Options › Plugin performance monitor: now/average/peak per instrument and effect slot, rack load, find, freeze, reset on play |
 | TGraphEditorForm | event graph (channel/mixer automation editor) | partial | automation clip editor (AutomationUi) |
 
 ## Settings ("Settings" = TMIDIForm, one window with pages)
@@ -61,11 +61,11 @@ window); **missing** = nothing yet; **n/a** = not applicable to LYNX.
 |---|---|---|
 | TMissingPluginsForm + "%d sample(s) required by this project could not be located." | **exists (round 81)** | Missing files window: samples (search folder, locate, skip, remembered folders), plugins with replacements, auto-relocated list |
 | TInfoForm "Song info" (shown on opening) | exists (round 81) | Settings › Info opens with the project when "Show this page when the project is opened" is on |
-| TNewProjForm "New project" (PPQ, time signature, name/location, info) | partial | File › New + templates menu; no dialog |
+| TNewProjForm "New project" (PPQ, time signature, name/location, info) | **exists (round 84)** | New project window: templates (built-in + user folder), name/folder, tempo/time signature, info; no PPQ choice |
 | TProjectRenameForm "Rename project" | missing | |
-| TRenderForm / TWAVRenderForm "WAV rendering" | exists | Export dialog: WAV 16/24/32f, FLAC, OGG, sample rate, tail, stems |
-| TMEMP3OptionsForm "MP3 export" | missing | no MP3 encoder |
-| TMEOggOptionsForm "Ogg Vorbis export" | partial | OGG export, no quality options |
+| TRenderForm / TWAVRenderForm "WAV rendering" | **exists (round 84)** | Export window: WAV/MP3/OGG/FLAC, depth, bitrate, FLAC level, rate, channels, dither, tail cut/leave/wrap, loops, song/pattern/selection, stems per insert or channel, normalize, master effects, PDC trim |
+| TMEMP3OptionsForm "MP3 export" | **exists (round 84)** | MP3 in the Export window (LAME, 96–320 kbps) |
+| TMEOggOptionsForm "Ogg Vorbis export" | **exists (round 84)** | OGG bitrate 64–500 kbps in the Export window |
 | TExportScoreForm "Export as score sheet" | missing | |
 | TMIDIImportForm "Import MIDI data" | partial | .mid opens as a project / into a channel, no options dialog |
 | TDWPRenderForm "DirectWave Instrument rendering" | n/a | |
@@ -75,8 +75,8 @@ window); **missing** = nothing yet; **n/a** = not applicable to LYNX.
 | TTapTempoForm "Tempo tapper" | exists | tempo menu › Tap tempo |
 | TAddMarkerSettingsForm "Marker settings" | partial | add/rename marker menu items |
 | TPRTimeSigForm "Time signature change" | partial | playlist signature menu |
-| TPLClipPropForm "Clip properties" | missing | (playlist is another agent's area) |
-| TPLMergeArrangementForm "Merge arrangement" | missing | arrangements exist |
+| TPLClipPropForm "Clip properties" | **exists (round 84)** | clip menu › Properties...: source/name/colour, track, start/length/offset, mute; audio gain, fades, pitch, stretch; group mute/gain |
+| TPLMergeArrangementForm "Merge arrangement" | **exists (round 84)** | Arrangements window: list, show/new/duplicate/rename/remove/reorder, merge insert/merge/replace at start/playback/end |
 | TPRNotePropForm "Note properties" | exists | Note inspector in the Piano Roll |
 | TEventEditForm "Piano roll - " (event editor) | missing | automation editor covers automation clips only |
 | TEnvMapForm "Mapping" (velocity/controller curves) | missing | |
@@ -122,6 +122,8 @@ normalise, region and stretch). These belong to an "Audio editor" feature, not t
 
 ## Queue (not done in round 81), priority order
 
+Round 84 did items 7, 8, 9, the export part of 10 (MP3, OGG quality, dither) and the New project dialog of 11.
+
 Round 82 did items 1 (General + Audio; not pan law / data folder), 2, 4 (inputs; not outputs/sync) and 6.
 
 1. **Settings › General** (moves the scattered Options items into one page) and **Settings › Audio** as a page

+ 9 - 2
src/Main.cpp

@@ -1183,7 +1183,7 @@ private:
         quit();
     }
 
-    // LYNX.exe --export project.(flp|lynx) output.(wav|flac|ogg) [--pattern] [--insert N]
+    // LYNX.exe --export project.(flp|lynx) output.(wav|flac|ogg|mp3) [--pattern] [--insert N]
     // Same path as "Export" in the UI: the whole song (or the current pattern) with its tail.
     void runExport (const juce::String& inputPath, const juce::String& outputPath, bool patternOnly, int insert)
     {
@@ -1223,7 +1223,14 @@ private:
                     loader.editSong ([] (lynx::Song& s) { s.automations.clear(); }, false);
 
                 const auto loaded = juce::Time::getMillisecondCounterHiRes();
-                lynx::ExportJob job (insert > 0 ? lynx::makeBounceSong (loader.getSong(), insert) : loader.getSong(), settings, output);
+                // .mp3: the Export window's MP3 (320 kbps); everything else as before
+                auto options = settings.toOptions();
+                if (output.hasFileExtension ("mp3"))
+                {
+                    options.format = lynx::exportopts::Format::mp3;
+                    options.mp3Kbps = 320;
+                }
+                lynx::ExportJob job (insert > 0 ? lynx::makeBounceSong (loader.getSong(), insert) : loader.getSong(), options, output);
                 const auto prepared = juce::Time::getMillisecondCounterHiRes();
                 int lastPercent = -1;
                 ok = job.run ([&lastPercent] (double p) {

+ 17 - 8
src/ui/ClipProperties.cpp

@@ -120,6 +120,9 @@ public:
         addAndMakeVisible (source);
         label (trackLabel, tr ("Track"));
         slider (track, 1, 500, 1, {});
+        track.setSliderStyle (juce::Slider::IncDecButtons);
+        track.setTextBoxStyle (juce::Slider::TextBoxLeft, false, 60, 22);
+        track.setIncDecButtonsMode (juce::Slider::incDecButtonsDraggable_Vertical);
 
         label (startLabel, tr ("Start"));
         editor (start);
@@ -161,7 +164,7 @@ public:
         groupGainMode.setSelectedItemIndex (0, juce::dontSendNotification);
         addAndMakeVisible (groupGainMode);
         groupGain.setSliderStyle (juce::Slider::LinearHorizontal);
-        groupGain.setTextBoxStyle (juce::Slider::TextBoxRight, false, 74, 22);
+        groupGain.setTextBoxStyle (juce::Slider::TextBoxRight, false, 64, 22);
         groupGain.setRange (-24.0, 12.0, 0.1);
         groupGain.setTextValueSuffix (" dB");
         addAndMakeVisible (groupGain);
@@ -176,7 +179,7 @@ public:
 
         engine.addChangeListener (this);
         load();
-        setSize (440, height());
+        setSize (460, height());
     }
 
     ~ClipPropertiesPanel() override { engine.removeChangeListener (this); }
@@ -207,7 +210,12 @@ public:
         row (nameLabel, name);
         row (colourLabel, colours);
         row (sourceLabel, source);
-        row (trackLabel, track);
+        {
+            auto r = area.removeFromTop (rowHeight);
+            trackLabel.setBounds (r.removeFromLeft (labelWidth));
+            track.setBounds (r.removeFromLeft (130));
+            area.removeFromTop (gap);
+        }
         title (timeTitle);
         {
             auto r = area.removeFromTop (rowHeight);
@@ -243,7 +251,7 @@ public:
             row (groupMuteLabel, groupMute);
             auto r = area.removeFromTop (rowHeight);
             groupGainLabel.setBounds (r.removeFromLeft (labelWidth));
-            groupGainMode.setBounds (r.removeFromLeft (112));
+            groupGainMode.setBounds (r.removeFromLeft (120));
             r.removeFromLeft (6);
             groupApply.setBounds (r.removeFromRight (70));
             r.removeFromRight (6);
@@ -256,11 +264,12 @@ private:
 
     int height() const
     {
-        auto h = 12 + 30 * 3 + 32 * 6 + 12 + 30 + 12; // titles, rows, buttons
+        // margins + buttons, then 30 per section title and 32 per row
+        auto h = 24 + 30 + 14 + 2 * 30 + 6 * 32;
         if (isAudio())
-            h += 30 + 32 * 5 + 28;
+            h += 30 + 5 * 32 + 28;
         if (selection.size() > 1)
-            h += 30 + 32 * 2;
+            h += 30 + 2 * 32;
         return h;
     }
 
@@ -500,7 +509,7 @@ public:
         engine.addChangeListener (this);
         refresh();
         list.selectRow (engine.getSong().currentArrangement);
-        setSize (500, 430);
+        setSize (520, 480);
     }
 
     ~ArrangementsPanel() override { engine.removeChangeListener (this); }

+ 1 - 1
src/ui/ExportDialog.cpp

@@ -298,7 +298,7 @@ public:
         cancelButton.onClick = [this] { close(); };
 
         writeControls();
-        setSize (620, 452);
+        setSize (620, 404);
     }
 
     // --snapshot: the window with this format chosen (0 WAV, 1 MP3, 2 OGG, 3 FLAC) and a few options set

+ 5 - 4
src/ui/NewProjectDialog.cpp

@@ -238,7 +238,7 @@ public:
             templates.selectRow (2);
         }
         templateChosen();
-        setSize (700, 520);
+        setSize (700, 540);
     }
 
     void resized() override
@@ -290,9 +290,10 @@ public:
             auto r = area.removeFromTop (rowHeight);
             tempoLabel.setBounds (r.removeFromLeft (labelWidth));
             tempo.setBounds (r.removeFromLeft (150));
-            r.removeFromLeft (16);
-            meterLabel.setBounds (r.removeFromLeft (100));
-            meter.setBounds (r);
+            area.removeFromTop (gap);
+            r = area.removeFromTop (rowHeight);
+            meterLabel.setBounds (r.removeFromLeft (labelWidth));
+            meter.setBounds (r.removeFromLeft (150));
             area.removeFromTop (gap + 4);
         }
 

+ 6 - 5
src/ui/PluginMonitorWindow.cpp

@@ -16,7 +16,7 @@ using namespace settingsui;
 
 juce::String percent (double v)
 {
-    return v < 0.05 ? juce::String ("-") : juce::String (v, v < 10.0 ? 1 : 0) + "%";
+    return v < 0.05 ? juce::String ("-") : v < 10.0 ? juce::String (v, 1) + "%" : juce::String (juce::roundToInt (v)) + "%";
 }
 
 juce::Colour loadColour (double v)
@@ -179,7 +179,7 @@ public:
             startTimerHz (4);
         }
         timerCallback();
-        setSize (640, 380);
+        setSize (720, 380);
     }
 
     ~PluginMonitorPanel() override
@@ -221,13 +221,14 @@ public:
         auto area = getLocalBounds().reduced (14, 12);
         auto top = area.removeFromTop (28);
         findLabel.setBounds (top.removeFromLeft (44));
-        find.setBounds (top.removeFromLeft (220));
+        find.setBounds (top.removeFromLeft (200));
         top.removeFromLeft (12);
         pluginsOnly.setBounds (top.removeFromLeft (120));
         reset.setBounds (top.removeFromRight (80));
         top.removeFromRight (8);
-        resetOnPlay.setBounds (top.removeFromRight (120));
-        freeze.setBounds (top.removeFromRight (80));
+        resetOnPlay.setBounds (top.removeFromRight (124));
+        top.removeFromRight (6);
+        freeze.setBounds (top.removeFromRight (84));
         area.removeFromTop (10);
         auto bottom = area.removeFromBottom (20);
         total.setBounds (bottom.removeFromLeft (bottom.getWidth() / 2));

+ 1 - 1
src/ui/TouchKeyboard.cpp

@@ -196,7 +196,7 @@ public:
             keys.repaint();
         };
         addAndMakeVisible (labels);
-        target.setFont (theme::font (theme::type::small));
+        target.setFont (theme::font (theme::type::body));
         target.setColour (juce::Label::textColourId, theme::colour::textSecondary);
         target.setJustificationType (juce::Justification::centredRight);
         addAndMakeVisible (target);