Ogg Vorbis support to Cipher
Overview
Author: seryu
Date Submitted: 2004-04-21 17:42:04
Downloads: Ogg Vorbis support.zip
Source Code
Description
Article in pdf format.
Add changes, Clean & Compile. Thats it!
Now you simply use Cipher Audio functions to play ogg vorbis compressed files.
Advice: you cannot put files inside the pak files, since they are already compressed who cares.
[Recent Contributions] [Recent Source Code]
User Contributed Comments
rikh 22nd April, 2004 07:07
Nice article.
You use a function called fs_FileIO. I am guessing this just returns the FILE* for the opened file, if it has one. Am I right?
seryu 22nd April, 2004 14:19
ops! i forgot that :P
Yes, it returns FILE pointer.
at filesystem.c:
/*
===================
fs_GetFileIO
for ogg vorbis functions
===================
*/
FILE* fs_GetFileIO(int handle)
{
if ((handle<1) || (handle>=MAX_OPEN_FILES))
return NULL;
// get the file structure
return fs.openfiles[handle].file;
}
the_cX 22nd April, 2004 17:19
that was helpful. thanks.
monty 10th November, 2004 19:39
After the release of Build 2897 I tried and used the Ogg Vorbis feature.
It's nice to have Ogg Vorbis support, but it would be nicer to be able to put ogg files inside your Pak data file (I know oggs are already compressed...)
That's why I implemented this feature. The trick is simple:
we must use ov_open_callbacks() instead of ov_open() to open an ogg file, and we must provide callbacks substitutes for at least the fread() and fclose() functions (fseek() and ftell() are optional). This way the ogg library can read from any kind of source, even if it is not seekable.
It is easy to write a wrapper for fs_ReadBytes() and fs_Close() (unfortunatetly we don't have a sort of fs_Seek(), so we must consider our stream unseekable)
We don't even need to expose the FILE* pointer with fs_GetFileIO!
The only drawback is, since the stream is not seekable, we can't simply open the file, test if it is an ogg file, and if it fails read it as a standard wav file.
Instead we must open the file, try and read as a standard wav file, if it fails close it and reopen, try and read as an ogg file..
I tried it with CCC and it works (I changed the track1.wav with some other ogg file inside the game.pak).
If anybody is interested to test it I can send the modified snd_wave.c file (and you can safely delete the fs_GetFileIO() from filesystem.c)
niblick 17th February, 2005 13:46
I am currently working on audio programming in Cipher, and am looking to include OGG support. I found the OGG tutorial here, but however am having problems locating the correct header and include files.
I have downloaded the Ogg Vorbis Win32 SDK (1.0.1), and I could not locate the correct .lib files that are mentioned in the tutorial. I also downloaded the libogg source (1.0.1), and libvorbis source (1.0.1). However parts of these seem to be corrupted.
Could someone please point me in the right direction concerning where I can download the files required for the tutorial.
Thanks
niel_dagondon 18th February, 2005 06:26
Ummm... as far as I know (although we havent gotten there yet) the latest cipher already supports ogg.
just be sure the Cipher Core includes the vorbis directory in it's includes.
philk 18th February, 2005 15:43
Unfortunatly the code provided here does not work with the cipher PAK file system. I have sent rik my code which integrates nicely into the file system but it did not make it into any cipher release yet.
ruzark 11th March, 2005 18:51
could you post it to the user contribution section philk? thank you
philk 11th March, 2005 22:40
Just submitted my code. Allow up to 24 hours to appear.
seryu 13th March, 2005 11:51
Edit: I was wrong about lastest cipher code :/
Edited 14th March, 2005 14:11
philk 13th March, 2005 21:19
@seryu: Thanks for your contribution. But I can only repeat what I already stated: Your code found in the latest source2897.zip does NOT comply with the cipher PAK file system. You introduce some awkward FILE structure and read directly from the disk instead of using ciphers file routines. To make it clear: With your solution one can never load or stream sounds from within a PAK file. My code integrates fully into Cipher and is based on your basic work.
seryu 14th March, 2005 14:10
Oh, sorry, I really think Rikh updated it on the last source.
Since im working with custom cipher version, I looked at sourced & I think this change was rikh, not mine sourcecode.
Well, when you changes will get upload on User Contribution All of us could use it :-) and I hope rikh will add it to cipher.
Regards.
philk 14th March, 2005 15:42
@seryu: Seems to many source code versions are floating around here :) I uploaded it it already on saturday. We will see when it appears.
philk 16th March, 2005 00:42
code is up in the user contributions section
Register and Sign In to discuss this article Copyright (c) 2003-2009 MBC Entertainment. All rights reserved
cipherengine.com and the Cipher game engine are wholly owned by MBC Entertainment.
All trademarks are the property of their respective owners.