#sleela 2.5 material; < codec-pipeline.sleela -- the self-contained, runnable build of the SLeeLa > < audio codec Controller/Verifier/Processor pipeline. The compiler's `run` > < compiles one file as a single unit, so this aggregate inlines the > < collaborators (mirroring the split SLCodecController / SLCodecVerifier / > < SLCodecProcessor / SLCodecLoader discovery files) plus a `main` that drives > < them the way a GUI or app would: resolve -> load -> verify -> decode/encode > < -> unload. The split per-class files are the package's discovery surface; > < this file is the executable counterpart, mirroring codecs.sleela. > < > < Codec ids: 0 PCM_WAV 1 AIFF 2 FLAC ... 15 G711_MULAW 16 G711_ALAW 17 MIDI > < 18 MATROSKA_AUDIO 19 WEBM_AUDIO. States: 0 native 1 backend 2 recognized > < 3 container 4 event. Result codes: 0 ok -1 unsupported -2 invalid -3 format > < -4 io -5 not-loaded. > < > < Syntax 1.11: method calls resolve on class-typed fields, so the Controller > < holds its Verifier and Processor as fields (wired in create()) and delegates > < through them. A GUI drives one object: ctrl.decode(id), ctrl.resolveExtension > < (ext), ctrl.resultText(code) -- no facts threaded by hand. > < ---- Verifier: extension/magic resolution + result text ---------------- > class Verifier { < ---- Descriptive metadata (version 1.11 nested-friendly accessors) ---- > << Eleven catalogued attributes with getter/setter pairs, so a GUI, loader, or catalog can read and (where appropriate) override this record. Values are faithful to the subject's real origin where publicly known. >> String metaVersion = "1.0.0"; int metaId = 10961; String metaAuthor = "Kiro Agent"; String metaDate = "2026-10-16"; String metaCopyright = "SLeeLa project"; String metaTrademark = "none"; String metaCorporation = "none"; < metaOrigin: National | | International | Galactic > String metaOrigin = "International"; String metaBirthDate = "2026-10-10"; < metaScienceRating: maturity/robustness on a 1..10 scale > int metaScienceRating = 9; < metaNationalSchedule: a real, citable instrument or "none" > String metaNationalSchedule = "none"; String getMetaVersion() { return metaVersion; } void setMetaVersion(String v) { metaVersion = v; } int getMetaId() { return metaId; } void setMetaId(int v) { metaId = v; } String getAuthor() { return metaAuthor; } void setAuthor(String v) { metaAuthor = v; } String getDate() { return metaDate; } void setDate(String v) { metaDate = v; } String getCopyright() { return metaCopyright; } void setCopyright(String v) { metaCopyright = v; } String getTrademark() { return metaTrademark; } void setTrademark(String v) { metaTrademark = v; } String getCorporation() { return metaCorporation; } void setCorporation(String v) { metaCorporation = v; } String getOrigin() { return metaOrigin; } void setOrigin(String v) { metaOrigin = v; } String getBirthDate() { return metaBirthDate; } void setBirthDate(String v) { metaBirthDate = v; } int getScienceRating() { return metaScienceRating; } void setScienceRating(int v) { metaScienceRating = v; } String getNationalSchedule() { return metaNationalSchedule; } void setNationalSchedule(String v) { metaNationalSchedule = v; } int resolveExtension(String ext) { if (ext == ".wav") { return 0; } if (ext == ".aif" || ext == ".aiff") { return 1; } if (ext == ".flac") { return 2; } if (ext == ".opus") { return 8; } if (ext == ".mid" || ext == ".midi") { return 17; } return -1; } int probeMagic(String tag) { if (tag == "RIFF") { return 0; } if (tag == "fLaC") { return 2; } if (tag == "OpusHead") { return 8; } if (tag == "MThd") { return 17; } return -1; } String resultText(int code) { if (code == 0) { return "ok"; } if (code == -1) { return "unsupported (backend not present)"; } if (code == -2) { return "invalid arguments"; } if (code == -3) { return "input is not this codec's format"; } if (code == -4) { return "I/O or allocation failure"; } if (code == -5) { return "codec not loaded"; } return "unknown"; } } < ---- Processor: pure decode/encode dispatch over the facts ------------- > class Processor { int decode(boolean loaded, boolean nativeCodec, boolean backendReady) { if (!loaded) { return -5; } if (nativeCodec) { return 0; } if (backendReady) { return 0; } return -1; } int encode(boolean loaded, boolean nativeCodec, boolean backendReady) { if (!loaded) { return -5; } if (nativeCodec) { return 0; } if (backendReady) { return 0; } return -1; } } < ---- Controller: owns lifecycle + wires the collaborators as fields ---- > class Controller { int[] loaded; int[] backend; < wired by create(), called via the field (1.11) > Verifier verifier; Processor processor; void create() { loaded = new int[20]; backend = new int[20]; verifier = new Verifier(); processor = new Processor(); } int count() { return 20; } boolean isNative(int id) { return id == 0 || id == 1 || id == 15 || id == 16; } String nameOf(int id) { if (id == 0) { return "PCM/WAV"; } if (id == 2) { return "FLAC"; } if (id == 17) { return "MIDI"; } return "codec#" + id; } int load(int id) { loaded[id] = 1; return 0; } boolean isLoaded(int id) { return loaded[id] == 1; } void unloadAll() { int i = 0; while (i < 20) { loaded[i] = 0; i = i + 1; } } int registerBackend(int id) { backend[id] = 1; return 0; } boolean hasBackend(int id) { return backend[id] == 1; } int loadedCount() { int n = 0; int i = 0; while (i < 20) { if (loaded[i] == 1) { n = n + 1; } i = i + 1; } return n; } < Clean facade methods: delegate to the wired collaborators. > int resolveExtension(String ext) { return verifier.resolveExtension(ext); } int probeMagic(String tag) { return verifier.probeMagic(tag); } String resultText(int code) { return verifier.resultText(code); } int decode(int id) { return processor.decode(isLoaded(id), isNative(id), hasBackend(id)); } int encode(int id) { return processor.encode(isLoaded(id), isNative(id), hasBackend(id)); } void main() { print("=== SLeeLa audio codec pipeline (Controller/Loader/Verifier/Processor) ==="); create(); print("codecs known: " + count()); < Resolve a file the way a GUI would when the user opens it. > int wav = resolveExtension(".wav"); int flac = resolveExtension(".flac"); print("resolve .wav -> " + wav + " (" + nameOf(wav) + ")"); print("resolve .flac -> " + flac + " (" + nameOf(flac) + ")"); < Decode before load: honest state error (-5). > print("decode .wav before load: " + resultText(decode(wav))); < Load the native WAV codec and process it. > load(wav); print("decode .wav loaded: " + resultText(decode(wav))); print("encode .wav loaded: " + resultText(encode(wav))); < Load backend FLAC with no backend wired: unsupported (-1), not a false ok. > load(flac); print("decode .flac no backend: " + resultText(decode(flac))); < Wire a FLAC backend adapter, then it processes. > registerBackend(flac); print("decode .flac backend: " + resultText(decode(flac))); < Verifier content probe for a GUI pre-classify. > print("probe 'MThd' -> id " + probeMagic("MThd") + " (" + nameOf(17) + ")"); print("loaded count=" + loadedCount()); unloadAll(); print("after unloadAll, .wav loaded? " + isLoaded(wav)); print("done"); } }