Skip to content

Fix COMPILE_VSTI guard scope: always read gm.dls into lpGMDLSBuffer#11

Draft
Copilot wants to merge 5 commits into
masterfrom
copilot/extract-loop-points-and-envelope
Draft

Fix COMPILE_VSTI guard scope: always read gm.dls into lpGMDLSBuffer#11
Copilot wants to merge 5 commits into
masterfrom
copilot/extract-loop-points-and-envelope

Conversation

Copilot AI commented Jun 8, 2026

Copy link
Copy Markdown

The #ifdef COMPILE_VSTI guard at line 263 was incorrectly wrapping the entire file-open and ReadFile block, preventing lpGMDLSBuffer from being populated in non-VSTi builds. Only the new RIFF parsing logic should be conditional on COMPILE_VSTI.

Changes

  • Removed #ifdef COMPILE_VSTI from before the CreateFileA/ReadFile/CloseHandle block — file reading now occurs under #ifdef _WIN32 / #ifndef GMDLS_SKIP only
  • Moved #ifdef COMPILE_VSTI to guard only the new DLS RIFF parsing logic (the do { … } while(0) block) that follows the file read
// Before: entire block guarded
#ifdef COMPILE_VSTI
    HANDLE hFile = CreateFileA(...);
    if (hFile != INVALID_HANDLE_VALUE)
    {
        ReadFile(hFile, lpGMDLSBuffer, ...);
        CloseHandle(hFile);
        // new parsing logic ...
    }
#endif

// After: only parsing guarded
HANDLE hFile = CreateFileA(...);
if (hFile != INVALID_HANDLE_VALUE)
{
    ReadFile(hFile, lpGMDLSBuffer, ...);
    CloseHandle(hFile);
#ifdef COMPILE_VSTI
    // new parsing logic ...
#endif
}

Copilot AI added 2 commits June 8, 2026 12:13
…unk walker

- Add GMDLS_LoopInfo and GMDLS_EnvInfo structs to SynthNode.h with
  per-wave loop (loopStart/loopEnd/loopType/sourcePriority) and
  optional volume-envelope (attack/decay/sustain/release/validMask)
- Define GMDLS_LoopData[512] and GMDLS_EnvData[512] in SynthNode.cpp
- Replace naive byte-scan-for-'data' in Synth.cpp with a bounded
  two-pass RIFF/DLS chunk walker:
    Pass 1 LIST('wvpl'): loads PCM samples + wave-level wsmp loops,
    clamping loop bounds after upsampling and rejecting invalid loops
    Pass 2 LIST('lins'): applies region-level wsmp loops (higher
    priority) and art1/art2 EG1 connection blocks (attack/decay/
    sustain/release in timecents and hundredths-of-percent units)
- Guard file open with INVALID_HANDLE_VALUE check (defensive fix)
- All existing GMDLS_tick runtime behaviour is unchanged; new metadata
  is available for future consumption by sampler defaults or the UI
Copilot AI changed the title feat: extract GM.DLS loop points and EG1 envelope via bounded RIFF chunk walker feat: replace GM.DLS byte-scan with bounded RIFF chunk walker + extract loop/envelope metadata Jun 8, 2026
Copilot AI requested a review from gopher-atz June 8, 2026 12:18
Copilot AI changed the title feat: replace GM.DLS byte-scan with bounded RIFF chunk walker + extract loop/envelope metadata Guard GMDLS extraction code and math include behind COMPILE_VSTI Jun 8, 2026
Copilot AI changed the title Guard GMDLS extraction code and math include behind COMPILE_VSTI Fix COMPILE_VSTI guard scope: always read gm.dls into lpGMDLSBuffer Jun 8, 2026
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.

2 participants