Initial project import
This commit is contained in:
commit
d189bb22f4
19 files changed
+361
No files matched your search
@@ -0,0 +1,15 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
Copyright 2026 Matthew Mcclung
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at the URL above.
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -0,0 +1,8 @@
|
||||
# Agila open components
|
||||
|
||||
These standalone components are intentionally independent of proprietary Agila OS internals and may be considered for use in Agila Linux or other projects.
|
||||
|
||||
- `audio/` — basic waveform helpers
|
||||
- `font/` — bitmap font data identified by the original package as public domain
|
||||
|
||||
These files use the Apache License 2.0 except where a file states a different compatible license.
|
||||
@@ -0,0 +1,18 @@
|
||||
// Standalone waveform helpers. Apache-2.0 licensed.
|
||||
module agila_open_audio
|
||||
|
||||
import math
|
||||
|
||||
pub fn sine_wave(sample_rate int, frequency f64, duration f64, amplitude f64) []i16 {
|
||||
if sample_rate <= 0 || frequency <= 0 || duration <= 0 {
|
||||
return []i16{}
|
||||
}
|
||||
count := int(f64(sample_rate) * duration)
|
||||
mut samples := []i16{cap: count}
|
||||
for i in 0 .. count {
|
||||
t := f64(i) / f64(sample_rate)
|
||||
value := math.sin(2.0 * math.pi * frequency * t) * amplitude
|
||||
samples << i16(value)
|
||||
}
|
||||
return samples
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// font5x7.fv - 8x8 bitmap font (ASCII 32-126)
|
||||
module agila
|
||||
|
||||
const font5x7 = [u8(0x00), 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x40, 0x78, 0xc8, 0x5c, 0x08, 0x00, 0x00, 0x00, 0x00, 0x98, 0xa8, 0xe8, 0x00, 0x00, 0x00, 0x00, 0x08, 0x34, 0x68, 0xa0, 0x40, 0x00, 0x00, 0x00, 0x60, 0x9c, 0xa4, 0xc0, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0xf8, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x30, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0x84, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x84, 0xfc, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc4, 0xa4, 0x9c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x84, 0xa4, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x40, 0x50, 0x4c, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9c, 0x94, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0xec, 0xa4, 0xe4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x64, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xa4, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x94, 0x94, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x50, 0x50, 0x50, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xb4, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x70, 0x0c, 0x94, 0x94, 0x70, 0x00, 0x00, 0x00, 0x80, 0x78, 0x4c, 0x70, 0x80, 0x00, 0x00, 0x00, 0x00, 0x94, 0x94, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x84, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x84, 0x84, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x94, 0x94, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x14, 0x14, 0x00, 0x00, 0x00, 0x00, 0x30, 0xcc, 0x84, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x84, 0xfc, 0x84, 0x00, 0x00, 0x00, 0x00, 0x80, 0x84, 0x84, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x38, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x08, 0x10, 0x0c, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x08, 0x20, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x30, 0xcc, 0x84, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x14, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x30, 0xcc, 0x84, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x14, 0x6c, 0x80, 0x00, 0x00, 0x00, 0x00, 0x9c, 0x84, 0xe4, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0xfc, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x80, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x04, 0x30, 0xc0, 0x38, 0x00, 0x00, 0x00, 0x00, 0x1c, 0xc0, 0x30, 0xc0, 0x0c, 0x00, 0x00, 0x00, 0x80, 0x48, 0x30, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x04, 0x08, 0xf0, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc4, 0x84, 0x8c, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x60, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x08, 0x0c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0xb0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x90, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x90, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x90, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb8, 0xa8, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xfe, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x90, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x10, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0xfc, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x10, 0xf2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x20, 0xd0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xfc, 0x80, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x10, 0xf0, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x10, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x90, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x90, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x90, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x90, 0xd0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x90, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x80, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x80, 0x30, 0x00, 0x00, 0x00, 0x00, 0x30, 0xc0, 0x60, 0xc0, 0x10, 0x00, 0x00, 0x00, 0x00, 0x90, 0x60, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x90, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0xde, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xdc, 0x20, 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00]
|
||||
|
||||
pub fn glyph5x7(ch rune) []u8 {
|
||||
code := int(ch) - 32
|
||||
if code < 0 || code > 94 {
|
||||
return font5x7[0..8] // space
|
||||
}
|
||||
off := code * 8
|
||||
return font5x7[off..off+8]
|
||||
}
|
||||
Reference in new issue
Block a user