feat(ajm): implement sceAjmBatchJobSetResampleParametersEx #1045

Closed
aryanrawatispro-ship-it wants to merge 1 commit from upstream-pr/1045 into main
aryanrawatispro-ship-it commented 2026-10-07 03:44:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by aryanrawatispro-ship-it on 2026-10-07T03:44:39Z.


What

sceAjmBatchJobSetResampleParametersEx appends the resample parameters job with a start ratio and a per-sample change. The resampler applies the change after each output sample, so the ratio ramps linearly across jobs until resample parameters are set again, and sceAjmBatchJobGetResampleInfo reports the ratio the ramp has reached. sceAjmBatchJobSetResampleParameters is now the same job with a change of 0, so its behaviour does not change.

  • The start ratio is validated as before (finite, above 0), and the change must be finite; other values return SCE_AJM_ERROR_INVALID_PARAMETER. The flags argument is ignored, as for the non-Ex call.
  • The ratio is kept in double, so a long ramp does not drift from start + n * change.
  • Advancing by a ratio that the ramp made zero, negative or infinite throws, since nothing says what the console does there.

The signature comes from SharpProspero's Ajm.cs. No reimplementation applies the ramp: prosper registers the export as a no-op ("the host backend resamples") while leaving the non-Ex call unregistered, and PS5PCEM writes an unsupported-flag result. The ramp semantics are recorded in TechnicalDebt.

Tested

  • Linux (Ubuntu 24.04 on WSL2), GCC 13.2, Release, BUILD_TESTING=ON, lavapipe.
  • guest_ajm, new TestResampleRamp on the 6-frame MP3 stream:
    • start 2, change 0 gives the same samples as decimation by 2;
    • start 1, change 1 reads source positions 0, 1, 3, 6, 10, … (triangular numbers), each sample equal to the reference sample there, and GetResampleInfo reports 1 + samples written;
    • the same ramp over 16-sample jobs gives the same samples, with ratio 17 after the first job;
    • sceAjmBatchJobSetResampleParameters after an Ex ramp stops it;
    • start 2, change -1 throws when the ratio reaches 0;
    • invalid start ratios and non-finite changes are refused without appending a job.
  • On main the test stops with sceAjmBatchJobSetResampleParametersEx not implemented. Removing the ramp step, the Resampling check for the change, the ratio check, or swapping the advance and the ramp step each make it fail.
  • ctest: 379 of 380 pass; 20 GPU tests skip on lavapipe as on main. guest_sce_net aborts in this environment; it links only libSceNet, libSceNetCtl and libc, and fails the same way on unmodified main (its resolver test).
  • The patched libSceAjm.native.prx exports 5ldnD16rYZw.
  • Not tested on Windows or with a title.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4767651545 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1045). Originally posted by [aryanrawatispro-ship-it](https://github.com/aryanrawatispro-ship-it) on 2026-10-07T03:44:39Z. --- ### What `sceAjmBatchJobSetResampleParametersEx` appends the resample parameters job with a start ratio and a per-sample change. The resampler applies the change after each output sample, so the ratio ramps linearly across jobs until resample parameters are set again, and `sceAjmBatchJobGetResampleInfo` reports the ratio the ramp has reached. `sceAjmBatchJobSetResampleParameters` is now the same job with a change of 0, so its behaviour does not change. - The start ratio is validated as before (finite, above 0), and the change must be finite; other values return `SCE_AJM_ERROR_INVALID_PARAMETER`. The flags argument is ignored, as for the non-Ex call. - The ratio is kept in `double`, so a long ramp does not drift from `start + n * change`. - Advancing by a ratio that the ramp made zero, negative or infinite throws, since nothing says what the console does there. The signature comes from SharpProspero's [`Ajm.cs`](https://github.com/SvenGDK/SharpProspero/blob/main/src/SharpProspero/Interop/Audio/Ajm.cs). No reimplementation applies the ramp: [prosper](https://github.com/mattias800/prosper) registers the export as a no-op ("the host backend resamples") while leaving the non-Ex call unregistered, and PS5PCEM writes an unsupported-flag result. The ramp semantics are recorded in TechnicalDebt. ### Tested - Linux (Ubuntu 24.04 on WSL2), GCC 13.2, Release, `BUILD_TESTING=ON`, lavapipe. - `guest_ajm`, new `TestResampleRamp` on the 6-frame MP3 stream: - start 2, change 0 gives the same samples as decimation by 2; - start 1, change 1 reads source positions 0, 1, 3, 6, 10, … (triangular numbers), each sample equal to the reference sample there, and `GetResampleInfo` reports `1 + samples written`; - the same ramp over 16-sample jobs gives the same samples, with ratio 17 after the first job; - `sceAjmBatchJobSetResampleParameters` after an Ex ramp stops it; - start 2, change -1 throws when the ratio reaches 0; - invalid start ratios and non-finite changes are refused without appending a job. - On `main` the test stops with `sceAjmBatchJobSetResampleParametersEx not implemented`. Removing the ramp step, the `Resampling` check for the change, the ratio check, or swapping the advance and the ramp step each make it fail. - `ctest`: 379 of 380 pass; 20 GPU tests skip on lavapipe as on `main`. `guest_sce_net` aborts in this environment; it links only libSceNet, libSceNetCtl and libc, and fails the same way on unmodified `main` (its resolver test). - The patched `libSceAjm.native.prx` exports `5ldnD16rYZw`. - Not tested on Windows or with a title. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-07 03:45:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-07T03:45:03Z.


Progress report (0c952fe → 82d5b44)

📈 System libraries: 87.31% (+0.03%, +1 implemented functions)

✅ 1 implemented
Library Name
libSceAjm.native sceAjmBatchJobSetResampleParametersEx
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6030471132 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1045#issuecomment-6030471132). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-07T03:45:03Z. --- <!-- progress-report --> ### Progress report (0c952fe → 82d5b44) 📈 **System libraries**: 87.31% (+0.03%, +1 implemented functions) <details> <summary>✅ 1 implemented</summary> | Library | Name | | - | - | | libSceAjm.native | `sceAjmBatchJobSetResampleParametersEx` | </details>
aryanrawatispro-ship-it commented 2026-10-07 04:20:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by aryanrawatispro-ship-it on 2026-10-07T04:20:10Z.


Closing: like #867, this comes from the reference implementations only, and no title I know of reaches sceAjmBatchJobSetResampleParametersEx. I'll reopen it with the title ID and the log line if one does.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6030846987 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1045#issuecomment-6030846987). Originally posted by [aryanrawatispro-ship-it](https://github.com/aryanrawatispro-ship-it) on 2026-10-07T04:20:10Z. --- Closing: like #867, this comes from the reference implementations only, and no title I know of reaches `sceAjmBatchJobSetResampleParametersEx`. I'll reopen it with the title ID and the log line if one does.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!1045
No description provided.