tremor.library 1.0
==================
Plays Ogg Vorbis (.ogg) files on classic AmigaOS. Tremor (libvorbisidec,
the integer decoder from Xiph.Org) and libogg 1.3.6 are linked into one
shared library that exports the vorbisfile API: open your own streams
through callbacks, read 16-bit PCM, seek, comments, chained streams.
25 functions. Output is 16-bit signed, big endian, with the sample rate
and channel count of the stream.
* no FPU needed (integer-only codec)
* no ixemul, no other libraries, no C library in the application
required - only exec.library
* reentrant, any number of tasks may decode at the same time, each with
its own OggVorbis_File
* one build per CPU: 68000, 68020, 68030, 68040, 68060
* the 68020/030/040 builds use the 32x32->64 bit muls.l, the 68060 build
uses partial products instead; the output of all four is bit-identical
to a PC build of the same sources
* the 68000 build uses Tremor's low accuracy mode, which keeps all
products within 32 bit; its error is about -43 dB
Installation
------------
Copy the library for your CPU to LIBS:
CPU copy
68000 / 68010 Libs/68000/tremor.library
68020 Libs/68020/tremor.library
68030 Libs/68030/tremor.library
68040 Libs/68040/tremor.library
68060 Libs/68060/tremor.library
68080 (Vampire) Libs/68040/tremor.library
for example
Copy tremor/Libs/68040/tremor.library LIBS:
Do not use the 68020-68040 builds on a 68060: the 060 does not implement
the 64-bit muls.l and would trap into 68060.library on every multiply.
On a 68080 it is the other way round: it has that muls.l in hardware, and
the 68040 build is about twice as fast as the 68060 build.
Tool
----
C/oggdec file.ogg out.aiff
Shows stream information and decodes the file to an AIFF file. Runs
on every CPU.
In a chained stream that changes channel count or sample rate, the AIFF
header only fits the first part. The PCM data is correct.
Speed
-----
Measured on a 68080 (Vampire V4 Standalone, Kickstart 3.2), 68040 build:
44.1 kHz stereo, quality 5 about 2.5x real time
For older CPUs there are only estimates from the cycle counts of a CPU
emulator, without caches and memory timing:
44.1 kHz stereo 22 kHz mono
68000, 7 MHz 1/60 1/16
68020, 14 MHz 1/10 1/2.6
68030, 50 MHz 1/2.9 1.3x
So below the 68040 this is a library for converting files rather than for
playing music, except for low-rate mono streams on a fast 68030.
For programmers
---------------
SDK/ contains the include files (proto, clib, GCC inline, fd, lvo), the
SFD, the autodoc, the Vorbis and Ogg headers and the source of oggdec.
Compile with -ISDK/include.
#include <proto/exec.h>
#include <tremor/ivorbisfile.h>
struct Library *TremorBase = OpenLibrary(TREMOR_NAME, TREMOR_VERSION);
ov_callbacks cb = { my_read, my_seek, my_close, my_tell };
if (ov_open_callbacks(fh, &vf, NULL, 0, cb) == 0) {
while ((n = ov_read(&vf, buffer, sizeof(buffer), §ion)) != 0)
...
ov_clear(&vf);
}
CloseLibrary(TremorBase);
Differences from the original API:
* 64-bit values and ov_callbacks by value do not fit in a register. The
library exports OvPcmTotal(), OvTimeSeek(), OvOpenCallbacks() etc.
with pointers; inline functions in <tremor/ov_wrappers.h> provide the
original names and signatures, so source code does not change
* ov_open(), ov_fopen() and ov_test() use the FILE * of your C library,
so they exist only as inline functions: #define TREMOR_STDIO before
the include
* not exported: the low-level API (vorbis_synthesis_*, ogg_stream_*)
What the caller has to take care of:
* the library runs on the caller's stack: have at least 8 KB, the 4 KB
default of a Shell is too little
* callbacks use the C calling convention with arguments on the stack;
small-data programs must declare them __saveds
* the ov_read() buffer must be on an even address
* int must be 32 bit: do not compile with -mshort
* always call ov_clear(): the memory of a stream stays allocated in the
pool of the library otherwise
README.md (in German) has the details and how the library was built and
tested. Its paths refer to the source tree, not to this archive.
Tested
------
* Vampire V4 Standalone, 68080, Kickstart 3.2 (47.13): all five builds
decode eight test files (8 to 48 kHz, mono and stereo, quality -1 to
9, a chained stream) plus nine seeks each; PCM and all return values
are bit-identical to a PC build of the same sources; oggdec
* A1200 with Vampire, 68080, Kickstart 3.2: the 68040 build loads
* the same test under vamos with 68000, 68020 and 68040 emulation
* 1500 damaged files against a PC build with AddressSanitizer
Not yet tested on real 68000-68060 hardware, on UAE or on Kickstart
3.0/3.1, with several tasks decoding at the same time, or with very old
files that use floor 0.
Reports welcome.
History
-------
1.0 (05.10.2026) first release
License
-------
BSD, see COPYING.tremor and COPYING.libogg (Tremor, libogg (c) Xiph.Org
Foundation; AmigaOS port (c) 2026 Matthias Muench).
|