Crate app_lib

Crate app_lib 

Source
Expand description

AUDIO_HAXOR — Tauri v2 desktop app for audio plugin management.

This crate provides the Rust backend for scanning audio plugins (VST2/VST3/AU/CLAP), audio samples, DAW project files, and presets. It includes KVR Audio version checking, scan history with diffing, and export to JSON/TOML/CSV/TSV/PDF.

§Modules

  • scanner — Plugin filesystem scanner with architecture detection
  • scanner_skip_dirs — Shared directory-name blocklist for recursive scans
  • audio_extensions — Canonical audio sample extension list (scanner, walker, App Info)
  • audio_scanner — Audio sample discovery and metadata extraction
  • daw_scanner — DAW project scanner (14+ formats)
  • preset_scanner — Plugin preset discovery
  • audio_engine — Spawns the audio-engine AudioEngine (JUCE: devices, playback, VST3/AU scan) via stdin/stdout JSON
  • kvr — KVR Audio scraper and version checker
  • history — Scan history persistence, diffing, and preferences
  • content_hash — SHA-256 file hashing for byte-identical duplicate detection

Modules§

app_i18n
App UI strings for i18n: seeded into SQLite (app_i18n table) from i18n/app_i18n_en.json (toasts, menus, tray, HTML data-i18n*, dialogs). Locales cs, da, de, es, es-419, sv, fr, nl, pt, pt-BR, it, el, pl, ru, zh, ja, ko, fi, nb, tr, hu, ro, uk, vi, id, hi add rows with the same keys.
audio_engine
AudioEngine subprocess: the main app spawns the audio-engine JUCE binary (audio-engine/ CMake target), sends JSON lines on stdin, reads one JSON line per request. Keeps one child process alive (stdin loop in the AudioEngine) so stream state and IPC stay cheap. On app quit, shutdown_audio_engine_child runs from Tauri RunEvent::Exit / ExitRequested and from libc::atexit so the AudioEngine is always terminated with the host. AUDIO_HAXOR_PARENT_PID is set at spawn so the AudioEngine can exit if the host disappears without cleanup (e.g. macOS force quit / SIGKILL).
audio_extensions
Canonical audio sample extensions for the library scanner, unified walker, file watcher, and Settings → App Info. Keep in one place so UI labels match indexing.
audio_scanner
Audio sample file scanner with metadata extraction.
bpm
BPM estimation via onset-strength autocorrelation.
bulk_stat
Bulk directory enumeration + metadata fetch in a single syscall.
content_hash
Byte-level duplicate detection: SHA-256 over file contents.
daw_scanner
DAW project file scanner supporting 14+ DAW formats.
db
SQLite database layer for scalable storage of audio samples, analysis caches, and scan metadata. Replaces JSON file persistence for data that can grow to millions of rows.
file_watcher
Filesystem watcher for auto-scanning new/changed audio files, DAW projects, presets, plugins, PDFs, and MIDI.
history
key_detect
Musical key detection via chromagram analysis.
kvr
KVR Audio scraper and plugin version checker.
lufs
LUFS (Loudness Units Full Scale) measurement per ITU-R BS.1770.
midi
MIDI file parser — extracts metadata from Standard MIDI Files (.mid/.midi).
midi_scanner
MIDI file scanner — dedicated walker independent of the preset scanner.
native_menu
Native application menu bar — labels from SQLite app_i18n (see appFmt keys menu.*).
open_with_app 🔒
Cross-platform open file with named application for context menus and the command palette.
path_norm
Filesystem path strings as stored in SQLite: shorter keys on macOS.
pdf_meta
PDF metadata extraction (page count).
pdf_scanner
PDF file scanner.
preset_scanner
Plugin preset file scanner.
scanner
Plugin filesystem scanner for VST2, VST3, Audio Unit, and CLAP plugins.
scanner_skip_dirs
Directory names skipped during recursive filesystem scans.
similarity
Audio similarity search via spectral fingerprinting.
tray_menu
System tray / menu bar icon: playback controls, dynamic title + tooltip, popup menu, and (non-Linux) a WebView popover styled like macOS Now Playing (no artwork).
tray_popover_escape_macos 🔒
Tray popover: Escape closes the window.
unified_walker
Unified filesystem walker — traverses a union of roots once and classifies files into audio/daw/preset/pdf buckets by extension.
xref
Cross-reference engine: extract plugin references from DAW project files.

Structs§

AudioScanState 🔒
BuildInfo
Package + git metadata baked in at compile time (build.rsAUDIO_HAXOR_GIT_* env vars).
DawScanState 🔒
ExportPayload
ExportPlugin
MidiScanState 🔒
PalettePreviewResult
Single IPC round-trip for Cmd+K inventory preview (same limits as six separate db_query_* calls).
PdfScanState 🔒
PresetScanState 🔒
ScanState 🔒
SlowStatsSnapshot 🔒
Disk + DB file sizes + table_counts are expensive; the UI polls ~1 Hz.
UpdateState 🔒
UpdatedPlugin 🔒
WalkerStatus 🔒
Tracks active directory paths being walked by each scanner for live status display.

Constants§

DIRECTORY_SCAN_INCREMENTAL_DOMAIN
Domain string for SQLite directory_scan_state — shared by unified and standalone walkers.
SLOW_STATS_TTL 🔒

Statics§

APP_START 🔒
LOG_VERBOSITY_LEVEL 🔒
Cached app.log verbosity: 0 = quiet (suppress selected normal-level chatter), 1 = normal, 2 = verbose (extra scan/KVR diagnostics).
PDF_META_EXTRACT_ABORT 🔒
Set by pdf_metadata_extract_abort; checked between PDF page-count extraction chunks so the UI can stop CPU-heavy work when the PDF tab is hidden or the window is idle.
SLOW_STATS_CACHE 🔒

Functions§

app_log_verbose
Extra diagnostics when logVerbosity is verbose. f runs only if verbose (no format! cost otherwise).
append_log 🔒
audio_engine_eof_watchdog_start 🔒
audio_engine_eof_watchdog_stop 🔒
audio_engine_invoke 🔒
audio_engine_restart 🔒
audio_history_clear 🔒
audio_history_delete 🔒
audio_history_diff 🔒
audio_history_get_detail 🔒
audio_history_get_scans 🔒
audio_history_latest 🔒
audio_history_save 🔒
batch_analyze 🔒
Batch analyze: BPM + Key + LUFS for multiple files in parallel, save to SQLite. Analyzes files in parallel (rayon), batch-writes to DB, returns results directly so the frontend can update visible rows without extra IPC.
blocking 🔒
blocking_res 🔒
build_audio_engine_process_stats 🔒
build_fingerprint_cache 🔒
build_process_stats 🔒
cached_slow_stats 🔒
check_updates 🔒
clear_log 🔒
collect_audio_engine_process_metrics 🔒
compute_fingerprint 🔒
compute_slow_stats 🔒
daw_history_clear 🔒
daw_history_delete 🔒
daw_history_diff 🔒
daw_history_get_detail 🔒
daw_history_get_scans 🔒
daw_history_latest 🔒
daw_history_save 🔒
db_audio_filter_stats 🔒
db_audio_library_paths 🔒
db_audio_stats 🔒
db_backfill_audio_meta 🔒
db_cache_stats 🔒
db_clear_cache_table 🔒
db_clear_caches 🔒
db_daw_filter_stats 🔒
db_daw_stats 🔒
db_get_analysis 🔒
db_list_scans 🔒
db_midi_filter_stats 🔒
db_migrate_json 🔒
db_pdf_filter_stats 🔒
db_pdf_stats 🔒
db_plugin_filter_stats 🔒
db_preset_filter_stats 🔒
db_preset_stats 🔒
db_query_audio 🔒
db_query_daw 🔒
db_query_midi 🔒
db_query_palette_preview 🔒
db_query_pdfs 🔒
db_query_plugins 🔒
db_query_presets 🔒
db_unanalyzed_paths 🔒
db_update_analysis 🔒
Persist BPM, key, and LUFS together (same transaction and bpm_exhausted rules as batch analysis).
db_update_bpm 🔒
db_update_key 🔒
db_update_lufs 🔒
delete_data_file 🔒
delete_file 🔒
detect_audio_key 🔒
detect_separator 🔒
dotted_extensions_to_upper_tags 🔒
dsv_escape 🔒
estimate_bpm 🔒
export_audio_dsv 🔒
export_audio_json 🔒
export_daw_dsv 🔒
export_daw_json 🔒
export_pdf 🔒
export_pdf_impl 🔒
export_pdfs_dsv 🔒
export_pdfs_json 🔒
export_plugins_csv 🔒
export_plugins_json 🔒
export_presets_dsv 🔒
export_presets_json 🔒
export_toml 🔒
extract_project_plugins 🔒
find_content_duplicates 🔒
Byte-identical files across the scanned library (SHA-256 after grouping by stored size).
find_similar_samples 🔒
foreign_process_cpu_times_us 🔒
Per-PID user+system CPU time in microseconds (same units as libc::rusage tv_sec/tv_usec combined). Used so AudioEngine CPU% matches the header formula: (Δuser + Δsys) / Δwall * 100.
format_size
Shared utility: format bytes to human-readable string.
fs_list_dir 🔒
get_active_scan_inventory_counts 🔒
Per-category row counts for the header strip — library scope (one row per path), not the current in-progress scan_id. See db::Database::active_scan_inventory_counts.
get_app_strings 🔒
get_audio_engine_process_stats 🔒
get_audio_metadata 🔒
get_build_info 🔒
get_cpu_percent 🔒
get_cpu_percent_like_rusage_for_pid 🔒
Same formula as get_cpu_percent (getrusage user+sys deltas vs wall clock), for another PID.
get_file_watcher_status 🔒
get_home_dir 🔒
get_midi_info 🔒
get_open_fd_count 🔒
get_prefs_path 🔒
get_process_info 🔒
get_process_stats 🔒
get_rss_bytes 🔒
get_thread_count 🔒
get_toast_strings 🔒
get_unified_scan_run 🔒
get_uptime_secs 🔒
get_version 🔒
get_virtual_bytes 🔒
get_walker_status 🔒
gethostname 🔒
history_clear 🔒
history_delete 🔒
history_diff 🔒
history_get_detail 🔒
history_get_scans 🔒
history_latest 🔒
import_audio_json 🔒
import_daw_json 🔒
import_pdfs_json 🔒
import_plugins_json 🔒
import_presets_json 🔒
import_toml 🔒
incremental_directory_scan_enabled 🔒
kvr_cache_get 🔒
kvr_cache_update 🔒
list_data_files 🔒
load_incremental_dir_state_for_walk 🔒
log_shutdown 🔒
log_verbosity_level
measure_lufs 🔒
midi_history_clear 🔒
midi_history_delete 🔒
midi_history_diff 🔒
midi_history_get_detail 🔒
midi_history_get_scans 🔒
midi_history_latest 🔒
midi_history_save 🔒
normalize_fingerprint_cache_map 🔒
Fingerprint cache keys in SQLite are written with normalize_path_for_db; align in-memory lookups and inserts so contains_key matches paths from the UI (allAudioSamples).
open_audio_folder 🔒
open_daw_folder 🔒
open_daw_project 🔒
open_fd_count_for_pid 🔒
open_file_default 🔒
open_pdf_file 🔒
open_plugin_folder 🔒
open_prefs_file 🔒
open_preset_folder 🔒
open_update_url 🔒
open_with_app 🔒
palette_preview_empty 🔒
pdf_history_clear 🔒
pdf_history_delete 🔒
pdf_history_diff 🔒
pdf_history_get_detail 🔒
pdf_history_get_scans 🔒
pdf_history_latest 🔒
pdf_history_save 🔒
pdf_metadata_extract_abort 🔒
pdf_metadata_extract_batch 🔒
pdf_metadata_get 🔒
pdf_metadata_unindexed 🔒
Paths in the PDF library (pdf_library) with no pdf_metadata row yet — used to kick off background page-count extraction for the whole inventory, not only the latest scan.
persist_incremental_dir_state_after_walk 🔒
plugins_to_export 🔒
prefs_get_all 🔒
prefs_remove 🔒
prefs_save_all 🔒
prefs_set 🔒
prepare_unified_scan 🔒
Clears unified stop flags before the scan_unified invoke (after the frontend’s listener-registration delay). Without this, scan_unified would reset stop_scan to false at entry and erase a Stop All that happened during that delay — scans looked like they “could not stop”.
preset_history_clear 🔒
preset_history_delete 🔒
preset_history_diff 🔒
preset_history_get_detail 🔒
preset_history_get_scans 🔒
preset_history_latest 🔒
preset_history_save 🔒
read_als_xml 🔒
read_als_xml_impl 🔒
read_binary_project 🔒
Read any binary DAW project file and return a structured JSON tree.
read_binary_project_inner 🔒
read_bwproject 🔒
read_cache_file 🔒
read_log 🔒
read_project_file 🔒
Generic project file reader: returns {type: “xml”|“tree”, content: …} XML formats get raw XML string, binary formats get structured JSON tree.
read_text_file 🔒
read_zip_xml 🔒
Read XML from a ZIP archive (Studio One, DAWproject).
refresh_log_verbosity_from_prefs 🔒
refresh_native_menu 🔒
Rebuild the native menu bar from SQLite app_i18n for the current UI locale (after changing language in Settings).
rename_file 🔒
resolve_kvr 🔒
resolve_ui_locale 🔒
run
scan_audio_samples 🔒
scan_daw_projects 🔒
scan_midi_files 🔒
scan_pdfs 🔒
scan_plugins 🔒
scan_presets 🔒
scan_unified 🔒
should_suppress_app_log_line 🔒
start_file_watcher 🔒
stop_audio_scan 🔒
stop_daw_scan 🔒
stop_file_watcher 🔒
stop_midi_scan 🔒
stop_pdf_scan 🔒
stop_preset_scan 🔒
stop_scan 🔒
stop_unified_scan 🔒
stop_updates 🔒
thread_count_for_pid_non_sysinfo 🔒
write_app_log
Public log-append entry point callable from any module. Writes a timestamped line to <data-dir>/app.log, rotating to .log.1 at 5MB. The append_log Tauri command delegates to this.
write_app_log_line 🔒
write_app_log_verbose
Like app_log_verbose when the message is already a String.
write_cache_file 🔒
write_text_file 🔒