{"_id":"@bun-win32/avrt","_rev":"4-dc000c40ee5490054e6a95191898fe4c","name":"@bun-win32/avrt","dist-tags":{"latest":"2.0.1"},"versions":{"1.0.0":{"name":"@bun-win32/avrt","version":"1.0.0","keywords":["bun","ffi","win32","windows","avrt","bindings","typescript","dll"],"author":"Stev Peifer <stev@bell.net>","license":"MIT","_id":"@bun-win32/avrt@1.0.0","maintainers":[{"name":"obscuritysrl","email":"stev@bell.net"}],"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dist":{"shasum":"95bfd6ff5404190af9b5bf2faecb591d61fe74b4","tarball":"https://registry.npmjs.org/@bun-win32/avrt/-/avrt-1.0.0.tgz","fileCount":6,"integrity":"sha512-I1vGXWTP5Y5LjqtgGjya+p7JGyz6d55mKcQ82I6UEDW4H6aOD6TJxfeNpRT3thUe/qWco88arNzuB4Z+dAMWpQ==","signatures":[{"sig":"MEQCIDA0Q0EQHP8mF2WptRb7ffHCVmhznqkhL9XbK5u7TAHLAiA2++mbP20QZsBS3asth7rru4nxjvb9d+d237TjkKxovw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":13804},"main":"./index.ts","type":"module","module":"index.ts","shasum":"95bfd6ff5404190af9b5bf2faecb591d61fe74b4","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:mmcss-jitter-scope":"bun ./example/mmcss-jitter-scope.ts","example:mmcss-profile-report":"bun ./example/mmcss-profile-report.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev@bell.net"},"_integrity":"sha512-I1vGXWTP5Y5LjqtgGjya+p7JGyz6d55mKcQ82I6UEDW4H6aOD6TJxfeNpRT3thUe/qWco88arNzuB4Z+dAMWpQ==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/avrt"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 AVRT bindings for Bun (FFI) on Windows.","directories":{},"sideEffects":false,"_nodeVersion":"24.3.0","dependencies":{"@bun-win32/core":"1.1.2"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest","@bun-win32/kernel32":"1.0.21"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/avrt_1.0.0_1779150536432_0.5266899415102937","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@bun-win32/avrt","version":"1.0.1","keywords":["bun","ffi","win32","windows","avrt","bindings","typescript","dll"],"author":"Stev Peifer <stev.p@outlook.com>","license":"MIT","_id":"@bun-win32/avrt@1.0.1","maintainers":[{"name":"obscuritysrl","email":"stev@bell.net"}],"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dist":{"shasum":"6c32ef81508fbf9162628e1241e8660b7bfab3aa","tarball":"https://registry.npmjs.org/@bun-win32/avrt/-/avrt-1.0.1.tgz","fileCount":6,"integrity":"sha512-mT9ZSccUAZU3IR0RywHgs5dIlC+vbxtOL7hBDJnSHiI9A3cm9FZPT6nGqFOCLGOULJy4I12mzxyLSP+jCCrAKw==","signatures":[{"sig":"MEYCIQD8udzF6Yts/h8a1bSS1myqCobiv5DWZ/hohtIfrY5hLgIhALLaC8JzNcsaC0cU+bJcIPP88d/s5cRhPqEFf1eXXdXx","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":13809},"main":"./index.ts","type":"module","module":"index.ts","shasum":"6c32ef81508fbf9162628e1241e8660b7bfab3aa","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:mmcss-jitter-scope":"bun ./example/mmcss-jitter-scope.ts","example:mmcss-profile-report":"bun ./example/mmcss-profile-report.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev@bell.net"},"_integrity":"sha512-mT9ZSccUAZU3IR0RywHgs5dIlC+vbxtOL7hBDJnSHiI9A3cm9FZPT6nGqFOCLGOULJy4I12mzxyLSP+jCCrAKw==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/avrt"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 AVRT bindings for Bun (FFI) on Windows.","directories":{},"sideEffects":false,"_nodeVersion":"24.3.0","dependencies":{"@bun-win32/core":"1.1.4"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest","@bun-win32/kernel32":"1.0.26"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/avrt_1.0.1_1781130783794_0.4675602047417011","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"name":"@bun-win32/avrt","version":"2.0.0","keywords":["bun","ffi","win32","windows","avrt","bindings","typescript","dll"],"author":"Stev Peifer <stev.p@outlook.com>","license":"MIT","_id":"@bun-win32/avrt@2.0.0","maintainers":[{"name":"obscuritysrl","email":"stev.p@outlook.com"}],"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dist":{"shasum":"2e177e2fa48278ab1a3b7e2d7474a108a2147f37","tarball":"https://registry.npmjs.org/@bun-win32/avrt/-/avrt-2.0.0.tgz","fileCount":6,"integrity":"sha512-nh4WiFu1BnJlSwSM2qJR8X/ZBTXdPyQIYjna7qHW9iUv3APlcECvgDbG0Xe3nuPxMlru6S8zsDdyaHUAuknF8A==","signatures":[{"sig":"MEYCIQDp3dEbXDhKdNhvq7SSkRP9hsKJJd973JToC/U4v6I5uQIhANdiVxmYUq/WqOX4l0z8HsI0gyInFZ51dgzohxuZp6FJ","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":15209},"main":"./index.ts","type":"module","module":"index.ts","shasum":"2e177e2fa48278ab1a3b7e2d7474a108a2147f37","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:mmcss-jitter-scope":"bun ./example/mmcss-jitter-scope.ts","example:mmcss-profile-report":"bun ./example/mmcss-profile-report.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev.p@outlook.com"},"_integrity":"sha512-nh4WiFu1BnJlSwSM2qJR8X/ZBTXdPyQIYjna7qHW9iUv3APlcECvgDbG0Xe3nuPxMlru6S8zsDdyaHUAuknF8A==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/avrt"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 AVRT bindings for Bun (FFI) on Windows.","directories":{},"sideEffects":false,"_nodeVersion":"26.3.0","dependencies":{"@bun-win32/core":"2.0.0"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest","@bun-win32/kernel32":"2.0.0"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/avrt_2.0.0_1782435268566_0.29516342716760025","host":"s3://npm-registry-packages-npm-production"}},"2.0.1":{"author":"Stev Peifer <stev.p@outlook.com>","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dependencies":{"@bun-win32/core":"2.0.1"},"description":"Zero-dependency, zero-overhead Win32 AVRT bindings for Bun (FFI) on Windows.","devDependencies":{"@bun-win32/kernel32":"2.0.1","@types/bun":"latest"},"exports":{".":"./index.ts"},"license":"MIT","module":"index.ts","name":"@bun-win32/avrt","peerDependencies":{"typescript":"^5"},"private":false,"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","repository":{"type":"git","url":"git://github.com/ObscuritySRL/bun-win32.git","directory":"packages/avrt"},"type":"module","version":"2.0.1","main":"./index.ts","keywords":["bun","ffi","win32","windows","avrt","bindings","typescript","dll"],"sideEffects":false,"engines":{"bun":">=1.1.0"},"scripts":{"example:mmcss-jitter-scope":"bun ./example/mmcss-jitter-scope.ts","example:mmcss-profile-report":"bun ./example/mmcss-profile-report.ts"},"_id":"@bun-win32/avrt@2.0.1","_integrity":"sha512-epiAElLcN/lq88ttsoNukFy1kHxNx3aCA6OBegUMkv7yd6wt+mcSOcv3J8G8istaYCgnuETZH9UTTZKz/m0+VA==","_nodeVersion":"26.3.0","_npmVersion":"10.8.3","shasum":"13aec61d6f952b758e05d8c958f36e24c1c43275","dist":{"integrity":"sha512-epiAElLcN/lq88ttsoNukFy1kHxNx3aCA6OBegUMkv7yd6wt+mcSOcv3J8G8istaYCgnuETZH9UTTZKz/m0+VA==","shasum":"13aec61d6f952b758e05d8c958f36e24c1c43275","tarball":"https://registry.npmjs.org/@bun-win32/avrt/-/avrt-2.0.1.tgz","fileCount":6,"unpackedSize":15209,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDTvHOnawxQtB55+mM4uIVwjHpeUJNg6R1KlKBvAn/JvwIgSkOojv58L10c0k8sPrMv3PaPlAJK0BA2Vshz+zXF6wI="}]},"_npmUser":{"name":"obscuritysrl","email":"stev.p@outlook.com"},"directories":{},"maintainers":[{"name":"obscuritysrl","email":"stev.p@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/avrt_2.0.1_1782437723423_0.6793522838377797"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-19T00:28:56.359Z","modified":"2026-06-26T01:35:23.693Z","1.0.0":"2026-05-19T00:28:56.591Z","1.0.1":"2026-06-10T22:33:03.953Z","2.0.0":"2026-06-26T00:54:28.719Z","2.0.1":"2026-06-26T01:35:23.560Z"},"bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"author":"Stev Peifer <stev.p@outlook.com>","license":"MIT","homepage":"https://github.com/ObscuritySRL/bun-win32#readme","keywords":["bun","ffi","win32","windows","avrt","bindings","typescript","dll"],"repository":{"type":"git","url":"git://github.com/ObscuritySRL/bun-win32.git","directory":"packages/avrt"},"description":"Zero-dependency, zero-overhead Win32 AVRT bindings for Bun (FFI) on Windows.","maintainers":[{"name":"obscuritysrl","email":"stev.p@outlook.com"}],"readme":"# @bun-win32/avrt\n\nZero-dependency, zero-overhead Win32 AVRT bindings for [Bun](https://bun.sh) on Windows.\n\n## Overview\n\n`@bun-win32/avrt` exposes the `avrt.dll` exports using [Bun](https://bun.sh)'s FFI. It provides a single class, `Avrt`, which lazily binds native symbols on first use. You can optionally preload a subset or all symbols up-front via `Preload()`.\n\n`avrt.dll` is the Multimedia Class Scheduler Service (MMCSS) client library: it lets a thread register with a multimedia task (\"Audio\", \"Pro Audio\", \"Games\", …), raise its scheduling priority, query the system-responsiveness reservation, and coordinate work across threads via thread-ordering groups — the same primitives low-latency audio and capture engines use.\n\nThe bindings are strongly typed for a smooth DX in TypeScript.\n\n## Features\n\n- [Bun](https://bun.sh)-first ergonomics on Windows 10/11.\n- Direct FFI to `avrt.dll` (MMCSS thread characteristics, AVRT priorities, system responsiveness, thread-ordering groups).\n- In-source docs in `structs/Avrt.ts` with links to Microsoft Docs.\n- Lazy binding on first call; optional eager preload (`Avrt.Preload()`).\n- No wrapper overhead; calls map 1:1 to native APIs.\n- Strongly-typed Win32 aliases (see `types/Avrt.ts`).\n\n## Requirements\n\n- [Bun](https://bun.sh) runtime\n- Windows 10 or later\n\n## Installation\n\n```sh\nbun add @bun-win32/avrt\n```\n\n## Quick Start\n\n```ts\nimport Avrt, { AVRT_PRIORITY } from '@bun-win32/avrt';\n\n// Join the \"Pro Audio\" MMCSS task; TaskIndex must be 0 on the first call.\nconst taskIndex = Buffer.alloc(4);\nconst handle = Avrt.AvSetMmThreadCharacteristicsW(Buffer.from('Pro Audio\\0', 'utf16le').ptr, taskIndex.ptr);\n\nif (handle !== 0n) {\n  Avrt.AvSetMmThreadPriority(handle, AVRT_PRIORITY.AVRT_PRIORITY_CRITICAL);\n\n  const responsiveness = Buffer.alloc(4);\n  Avrt.AvQuerySystemResponsiveness(handle, responsiveness.ptr);\n  console.log(`${responsiveness.readUInt32LE(0)}% reserved for non-MMCSS threads`);\n\n  // ... run latency-sensitive work ...\n\n  Avrt.AvRevertMmThreadCharacteristics(handle); // always pair with the join\n}\n```\n\n> [!NOTE]\n> AI agents: see `AI.md` for the package binding contract and source-navigation guidance. It explains how to use the package without scanning the entire implementation.\n\n## Examples\n\nRun the included examples:\n\n```sh\nbun run example/mmcss-jitter-scope.ts\nbun run example/mmcss-profile-report.ts\n```\n\n## Notes\n\n- Either rely on lazy binding or call `Avrt.Preload()`.\n- Always pair `AvSetMm*ThreadCharacteristics` with `AvRevertMmThreadCharacteristics`.\n- Thread-ordering-group APIs require the thread-ordering server; it is disabled on some SKUs (`AvRtCreateThreadOrderingGroup` then fails with `ERROR_SERVICE_DISABLED`).\n- Windows only. Bun runtime required.\n- **SAL types & naming:** nullability is in the **type** — `Optional<T>` (formally optional, SAL `_*opt_`) and `Nullable<T>` (plain `[in]`/`[out]` the docs say can be NULL), the null sentinel derived from `T` (`null` for pointers `LP*`/`P*`, `0n` for handles/by-value addresses); direction is in the **parameter name** — `_out` (`_Out_`), `_in_out` (`_Inout_`), `_In_` bare. See `AI.md` and the repo `AGENTS.md`.\n","readmeFilename":"README.md"}