You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Fix `perry setup` not saving to project perry.toml (auto-creates file
if missing, for all 3 platform wizards)
- Add docs for audio capture API (perry/system) and camera API (perry/ui)
- Update system overview, UI overview, widgets page, and SUMMARY.md
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: CLAUDE.md
+7-1Lines changed: 7 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
8
8
9
9
Perry is a native TypeScript compiler written in Rust that compiles TypeScript source code directly to native executables. It uses SWC for TypeScript parsing and Cranelift for code generation.
10
10
11
-
**Current Version:** 0.2.199
11
+
**Current Version:** 0.2.200
12
12
13
13
## Workflow Requirements
14
14
@@ -153,6 +153,12 @@ Projects can list npm packages to compile natively instead of routing to V8. Con
153
153
154
154
## Recent Changes
155
155
156
+
### v0.2.200
157
+
-**Fix `perry setup` not saving to project perry.toml**: all 3 platform wizards (iOS, Android, macOS) silently skipped writing to `perry.toml` when the file didn't exist — now auto-creates it; also removed redundant `perry_toml_path.exists()` guards on encryption_exempt writes since the file is guaranteed to exist after creation
158
+
-**Audio capture API (`perry/system`)**: `audioStart`, `audioStop`, `audioGetLevel` (dB(A)), `audioGetPeak`, `audioGetWaveformSamples`, `getDeviceModel` — all 6 platforms (macOS AVAudioEngine, iOS AVAudioSession, Android AudioRecord/JNI, Linux PulseAudio, Windows WASAPI, Web getUserMedia); A-weighted IIR filter, EMA smoothing, lock-free ring buffer
159
+
-**Camera API (`perry/ui`, iOS only)**: `CameraView`, `cameraStart`/`Stop`/`Freeze`/`Unfreeze`, `cameraSampleColor(x,y)` (5x5 averaged pixel sampling from CVPixelBuffer), `cameraSetOnTap` — AVCaptureSession + AVCaptureVideoPreviewLayer with dynamic ObjC delegate
160
+
-**Documentation**: new `docs/src/system/audio.md` and `docs/src/ui/camera.md`; updated system overview, UI overview, widgets page, and SUMMARY.md
161
+
156
162
### v0.2.199
157
163
-**Fix `import * as X` namespace function calls**: `X.foo()` on namespace imports fell through to `js_native_call_method` fallback instead of using pre-declared scoped wrappers — intercept in `Call { PropertyGet { ExternFuncRef } }` path after class static method check; also handles exported closures via `js_closure_callN` fallback
158
164
-**Fix ScrollView invisible inside ZStack**: ZStack's `add_child` (constraint-based) was dead code — `widgets::add_child` now detects ZStack parents via handle tracking and routes to `zstack::add_child`; also set `translatesAutoresizingMaskIntoConstraints: false` on NSScrollView for proper Auto Layout
The `perry/system` module provides real-time audio capture from the device microphone, with A-weighted dB(A) level metering and waveform sampling — everything needed to build a sound meter, audio visualizer, or voice-level indicator.
const ok =audioStart(); // 1 = success, 0 = failure
39
+
```
40
+
41
+
On platforms that require permission (iOS, Android, Web), the system permission dialog is shown automatically. Returns `1` on success, `0` on failure (e.g., permission denied, no microphone).
42
+
43
+
### `audioStop()`
44
+
45
+
Stop audio capture and release the microphone.
46
+
47
+
```typescript
48
+
audioStop();
49
+
```
50
+
51
+
### `audioGetLevel()`
52
+
53
+
Get the current A-weighted sound level in dB(A).
54
+
55
+
```typescript
56
+
const db =audioGetLevel(); // e.g. 45.2
57
+
```
58
+
59
+
Returns a smoothed dB(A) value (EMA with 125ms time constant). Typical ranges:
60
+
-~30 dB — quiet room
61
+
-~50 dB — normal conversation
62
+
-~70 dB — busy street
63
+
-~90 dB — loud music
64
+
-~110+ dB — dangerously loud
65
+
66
+
### `audioGetPeak()`
67
+
68
+
Get the current peak sample amplitude.
69
+
70
+
```typescript
71
+
const peak =audioGetPeak(); // 0.0 to 1.0
72
+
```
73
+
74
+
Returns a normalized amplitude value (0.0 = silence, 1.0 = clipping). Useful for simple level indicators without dB conversion.
75
+
76
+
### `audioGetWaveformSamples(count)`
77
+
78
+
Get recent dB samples for waveform visualization.
79
+
80
+
```typescript
81
+
const samples =audioGetWaveformSamples(64); // array of up to 64 dB values
82
+
```
83
+
84
+
Returns an array of recent dB(A) readings from a 256-sample ring buffer. Pass the number of samples you want (max 256). Useful for drawing waveform displays or level history charts.
85
+
86
+
### `getDeviceModel()`
87
+
88
+
Get the device model identifier.
89
+
90
+
```typescript
91
+
import { getDeviceModel } from"perry/system";
92
+
93
+
const model =getDeviceModel(); // e.g. "MacBookPro18,3", "iPhone15,2"
Copy file name to clipboardExpand all lines: docs/src/system/overview.md
+8-1Lines changed: 8 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@
3
3
The `perry/system` module provides access to platform-native system features: preferences, secure storage, notifications, URL opening, and dark mode detection.
0 commit comments