#sleela 2.5 material; < codecs.sleela -- the self-contained, runnable build of the SLeeLa codec > < Loader demonstration. The compiler's `run` compiles one file as a single > < unit, so this aggregate inlines the Loader contract (mirroring > < SLCodecLoader.sleela / the native codecs/ manager) and a `main` that loads, > < uses, and unloads codecs. SLeeLa calls the Loader; the Loader calls the > < individual codec plugins. > < > < Codec ids mirror sleela_codec_id: 0 PCM_WAV ... 15 G711_MULAW 16 G711_ALAW > < ... 19 WEBM_AUDIO. Native codecs (0, 15, 16) encode/decode in-package; the > < rest advertise a backend state and fail cleanly until a backend is wired. > < The per-codec loaded flags use the first-class array type. > class Codecs { < ---- 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 = 10061; 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-04"; < 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[] loaded; int count() { return 20; } void init() { loaded = new int[20]; } boolean isLoaded(int id) { return loaded[id] == 1; } void load(int id) { loaded[id] = 1; } void unload(int id) { loaded[id] = 0; } void unloadAll() { int i = 0; while (i < 20) { loaded[i] = 0; i = i + 1; } } boolean isNative(int id) { return id == 0 || id == 15 || id == 16; } String nameOf(int id) { if (id == 0) { return "PCM/WAV"; } if (id == 15) { return "G.711 mu-law"; } if (id == 16) { return "G.711 A-law"; } if (id == 2) { return "FLAC"; } if (id == 8) { return "Opus"; } return "codec#" + id; } String stateWord(int id) { if (isNative(id)) { return "native"; } return "backend"; } void report(int id) { String tag = "unloaded"; if (isLoaded(id)) { tag = "loaded"; } print(nameOf(id) + " [" + stateWord(id) + "] -> " + tag); } void main() { init(); < SLeeLa drives the Loader: load a native codec and a backend codec, use > < them, then unload. The Loader -- not the program -- owns each plugin. > < PCM/WAV (native) > load(0); < G.711 mu-law (native) > load(15); < FLAC (backend) > load(2); report(0); report(15); report(2); < Opus: never loaded > report(8); print("loaded native PCM/WAV? " + isLoaded(0)); print("FLAC is native? " + isNative(2)); unload(2); report(2); unloadAll(); print("after unloadAll, PCM/WAV loaded? " + isLoaded(0)); } }