Scripts, Tools & Methods Developed at Hook
And here we are with the final Ogg Vorbis/Alchemy post (at least for a while). We finally got all of the licensing stuff in order (see the license.txt file, and the comments at the top of the source files) and are ready to release the C source, Yay!
The majority of the C code is from Xiph.org. We basically took that, and hacked out the parts that wouldn’t compile through the alchemy/cygwin environment, such as the self tests and some of the macros. We then also forced some of the ifdefs to the correct settings, and reorganized the file structure to make it a bit easier to compile under cygwin. Once that was up and running, we spent the majority of our time building the wrapper C code (hookoggvorbislib.c) and the AS3 interface layer to access that C code. You can check out our Decoder/Encoder post to see how to use the library.
Once you download the source you can go into the alchemy/ogglib folder and check out all of the Alchemy source.
For a quick Cygwin refresher you can check out our other Alchemy Series posts on getting set up:
To compile the library it takes a couple of steps:
1) Open your Cygwin environment and turn on alc with “alc-on”
2) Change the directory to the alchemy/ogglib/lib folder
3) Delete the old object and archive files:./reset.sh
4) Compile the Xiph lib: ./compileLib.sh
5) Archive the lib: ./arcLib.sh
6) Move back up a directory level, and link with the wrapper:
cd .. ./linklib.sh
That should create a brand new .swc for you called hookOggVorbisLib.swc
Most of the concepts used in the wrapper code have been covered through out our Alchemy series and its fairly well commented. So feel free to poke around and see whats up. There is one limitation thus far, seeking is not working properly for the decoding. Of course if you decode the whole file into memory, then you can seek through the bytearray as you see fit. But the seeking to parts of the ogg data, and decoding from there is not working. If someone feels like tackling that let us know
In any case, have fun and let us know if you manage to put any of this to good use, we would love to hear about it!