Q-W1 pt1: extract core/json (json::Reader/Writer), collapse wire Cursor family into core/wire, shared readFileBytes — five JSON decoders and three cursor copies deleted, byte-identical formats, 59/59 green

This commit is contained in:
2026-07-28 19:59:02 -04:00
parent 88e7765ee5
commit 67a41728f3
25 changed files with 1695 additions and 1696 deletions
+46 -2
View File
@@ -82,12 +82,34 @@ set(SDK_INC ${CMAKE_CURRENT_SOURCE_DIR}/vendor/reaper-sdk/sdk)
set(WDL_INC ${CMAKE_CURRENT_SOURCE_DIR}/vendor/WDL/WDL)
set(SWELL ${WDL_INC}/swell)
# ---------------------------------------------------------------------------
# 0) core/ — the Q-W1 shared pure substrate. NO REAPER, NO SWELL, NO VST3.
# json: the ONE JSON lexical layer (reader + writer) behind the five
# persisted-blob (de)serializers (bank_model / bank_book /
# view_mode_model / owned_manifest / tail_control). T2-02 / §2.
# wire: the ONE length-prefixed ext-state wire codec (putField + Cursor +
# the guarded decimal accumulate) behind provenance /
# assignment_request / sample_usage / bank_sync. T2-01(b).
# file_bytes: the ONE whole-file byte loader both artifacts link. T2-03.
# Headers are included as "core/json/json.h" etc. (rooted at src/), so the
# include paths survive the Q-W1 part-2 directory relocation unchanged.
# ---------------------------------------------------------------------------
add_library(json STATIC src/core/json/json.cpp)
target_include_directories(json PUBLIC src)
add_library(wire STATIC src/core/wire/wire.cpp)
target_include_directories(wire PUBLIC src)
add_library(file_bytes STATIC src/core/util/file_bytes.cpp)
target_include_directories(file_bytes PUBLIC src)
# ---------------------------------------------------------------------------
# 1) Pure model library — NO REAPER, NO SWELL. Builds & tests anywhere.
# The sampler's heart: Sample metadata + BankIndex (Milestone 1).
# ---------------------------------------------------------------------------
add_library(bank_model STATIC src/bank_model.cpp)
target_include_directories(bank_model PUBLIC src)
target_link_libraries(bank_model PRIVATE json)
# ---------------------------------------------------------------------------
# 2) Pure peaks library — NO REAPER, NO SWELL. Waveform min/max thumbnails from
@@ -142,6 +164,7 @@ target_include_directories(tab_strip PUBLIC src)
# ---------------------------------------------------------------------------
add_library(view_mode_model STATIC src/view_mode_model.cpp)
target_include_directories(view_mode_model PUBLIC src)
target_link_libraries(view_mode_model PRIVATE json)
# The pure lane-minting decision (planLaneMinting) names managed lanes via the ONE
# durable-key convention in lane_keys (laneNameForMode), so the model depends on that
# pure sibling. PUBLIC so every consumer (tests + module) resolves the symbol.
@@ -224,6 +247,7 @@ target_include_directories(batch_capture PUBLIC src)
add_library(tail_control STATIC src/tail_control.cpp)
target_include_directories(tail_control PUBLIC src)
target_link_libraries(tail_control PUBLIC render_settings)
target_link_libraries(tail_control PRIVATE json)
# ---------------------------------------------------------------------------
# 2g') Pure bank_book library — NO REAPER, NO SWELL. The multi-bank phase heart
@@ -236,6 +260,7 @@ target_link_libraries(tail_control PUBLIC render_settings)
add_library(bank_book STATIC src/bank_book.cpp)
target_include_directories(bank_book PUBLIC src)
target_link_libraries(bank_book PUBLIC bank_model)
target_link_libraries(bank_book PRIVATE json)
# ---------------------------------------------------------------------------
# 2g'') Pure owned_manifest library — NO REAPER, NO SWELL. The owned-file manifest
@@ -248,6 +273,7 @@ target_link_libraries(bank_book PUBLIC bank_model)
# ---------------------------------------------------------------------------
add_library(owned_manifest STATIC src/owned_manifest.cpp)
target_include_directories(owned_manifest PUBLIC src)
target_link_libraries(owned_manifest PRIVATE json)
# ---------------------------------------------------------------------------
# 2g''') Pure prune_reconcile library — NO REAPER, NO SWELL, NO filesystem. The
@@ -323,6 +349,7 @@ target_include_directories(app_version PUBLIC src ${CMAKE_CURRENT_BINARY_DIR}/ge
# ---------------------------------------------------------------------------
add_library(provenance STATIC src/provenance.cpp)
target_include_directories(provenance PUBLIC src)
target_link_libraries(provenance PRIVATE wire)
# ---------------------------------------------------------------------------
# 2j') Pure assignment_request library — NO REAPER, NO SWELL, NO VST3. The S8 ingest
@@ -336,6 +363,7 @@ target_include_directories(provenance PUBLIC src)
# ---------------------------------------------------------------------------
add_library(assignment_request STATIC src/assignment_request.cpp)
target_include_directories(assignment_request PUBLIC src)
target_link_libraries(assignment_request PRIVATE wire)
# ---------------------------------------------------------------------------
# 2j'') Pure sample_usage library — NO REAPER, NO SWELL, NO VST3. The pS-usage seam:
@@ -349,6 +377,7 @@ target_include_directories(assignment_request PUBLIC src)
# ---------------------------------------------------------------------------
add_library(sample_usage STATIC src/sample_usage.cpp)
target_include_directories(sample_usage PUBLIC src)
target_link_libraries(sample_usage PRIVATE wire)
# ---------------------------------------------------------------------------
# 2l) Pure drag_out library — NO REAPER, NO SWELL, NO OS/OLE. The Milestone 11
@@ -538,6 +567,20 @@ target_link_libraries(sampler_core PUBLIC peaks pitch_shift velocity_curve)
# 3) Standalone tests for the pure modules (run without launching REAPER).
# ---------------------------------------------------------------------------
enable_testing()
# core/ (Q-W1): the shared JSON lexical layer, wire codec, and file loader.
add_executable(json_tests tests/test_json.cpp)
target_link_libraries(json_tests PRIVATE json)
add_test(NAME json_tests COMMAND json_tests)
add_executable(wire_tests tests/test_wire.cpp)
target_link_libraries(wire_tests PRIVATE wire)
add_test(NAME wire_tests COMMAND wire_tests)
add_executable(file_bytes_tests tests/test_file_bytes.cpp)
target_link_libraries(file_bytes_tests PRIVATE file_bytes)
add_test(NAME file_bytes_tests COMMAND file_bytes_tests)
add_executable(bank_model_tests tests/test_bank_model.cpp)
target_link_libraries(bank_model_tests PRIVATE bank_model)
add_test(NAME bank_model_tests COMMAND bank_model_tests)
@@ -822,6 +865,7 @@ target_link_libraries(waveform_view PUBLIC editor_geometry peaks)
add_library(bank_sync STATIC src/vst/bank_sync.cpp)
target_include_directories(bank_sync PUBLIC src/vst src)
target_link_libraries(bank_sync PUBLIC assignment_request)
target_link_libraries(bank_sync PRIVATE wire)
# browser_scroll (Phase S12) — PURE scroll-window + scrollbar-thumb + type-to-filter-search
# geometry LAYERED over the S10 capture_browser: the visible-card window, thumb rect +
@@ -1039,7 +1083,7 @@ add_library(reaper_reasampler MODULE
src/card_drag.cpp
src/usage_scan.cpp
)
target_link_libraries(reaper_reasampler PRIVATE bank_model capture_paths peaks bank_grid mode_switch tab_strip view_mode_model insert_plan render_settings batch_capture tail_control realtime_record bank_book wav_trim owned_manifest prune_reconcile prune_button app_version provenance drag_out instrument_drop theme component_geometry action_bar footer_bar overflow_menu mode_enable tooltip card_meta card_drag assignment_request bank_sync sample_usage)
target_link_libraries(reaper_reasampler PRIVATE json wire file_bytes bank_model capture_paths peaks bank_grid mode_switch tab_strip view_mode_model insert_plan render_settings batch_capture tail_control realtime_record bank_book wav_trim owned_manifest prune_reconcile prune_button app_version provenance drag_out instrument_drop theme component_geometry action_bar footer_bar overflow_menu mode_enable tooltip card_meta card_drag assignment_request bank_sync sample_usage)
target_include_directories(reaper_reasampler PRIVATE ${SDK_INC} ${WDL_INC})
# OUTPUT_NAME is channel-derived (Phase V, V4): "reaper_reasampler" (stable, default) or
# "reaper_reasampler_beta" (beta). REAPER dlopen's any reaper_* module, so both channels'
@@ -1201,7 +1245,7 @@ if(WIN32 AND EXISTS "${VST3_SDK}/public.sdk/source/main/pluginfactory.cpp")
sample_map capture_paths embed_strip app_version capture_browser keyboard_strip
waveform_view bank_sync browser_scroll note_entry param_slider
theme component_geometry bank_grid trigger_seam envelope_overlay envelope_edit
knob_deck curve_popup master_gain sample_usage)
knob_deck curve_popup master_gain sample_usage file_bytes)
# SDK_INC gives reaper_vst3_interfaces.h + reaper_plugin_functions.h for the bridge;
# WDL_INC gives LICE for the editor. The VST3 SDK headers come from vst3_sdk PUBLIC.
target_include_directories(reasampler_vst PRIVATE ${SDK_INC} ${WDL_INC})