Beginning Game Audio Programming [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Beginning Game Audio Programming [Electronic resources] - نسخه متنی

Mason McCuskey

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
توضیحات
افزودن یادداشت جدید





FROM ZERO TO VORBIS

It all starts by installing the libraries. On the CD you'll find several Ogg Vorbis ZIP files (in the Goodies folder). The following list shows you how to install those files. (I included everything on the CD if you're curious, but the only two files you need for this chapter are libvorbis-1.0.zip and OggVorbis-win32sdk-1.0.zip.)

The goal is to put all of the files from both zip files into one directory tree. So, you need to unzip each file into a separate directory (making sure to maintain the directory structure stored inside the zip file), and then copy the contents of each directory into one main directory (it's safe to overwrite files).

Either way, you should end up with a tree that contains include, lib, and win32 examples, and a whole bunch of other folders. In particular, make sure that you have both an ogg folder and a vorbis folder inside your include folder.



    Start a command shell (Go start, run, then type cmd on Windows NT, 2000, or XP, or command on Windows 95, 98, and Me).



    You need to set an environment variable called SRCROOT. To properly install the libraries, SRCROOT must point to the top-level folder where you unzipped the files. For example, if you copied both folders into a single folder called C:\libraries\oggvorbis, then at the command prompt you should type set SRCROOT=C:$libraries\oggvorbis. I'd highly recommend making sure that there are no spaces in the your install path, since then you won't have to deal with quoting this path.



    Type cd %SRCROOT%\win32. If you've set your SRCROOT environment variable correctly, you should end up in the win32 folder, C:\libraries\oggvorbis\win32.



    Inside this folder are batch files that build all of the different Ogg and Vorbis libraries. If you want to, you can run each batch file, but the only ones you need to run right now are build_vorbis_static.bat, build_vorbis_static_debug.bat, build_vorbisfile_static.bat, and build_vorbisfile_static_debug.bat. These batch files will create vorbis_static.lib, vorbis_static_d.lib, vorbisfile_static.lib, and vorbisfile_static_d.lib, respectively. Note that you will get some warnings when you compile these.



That's all it takes! I followed this exact process when building Ch8p1_OggVorbisPlayback. In the Chapter 8 source code folder, you will find a folder called libvorbis-1.0, which contains the built libraries.

The next step is to set up your DevStudio project to use the Ogg Vorbis libraries. If you want to add Ogg Vorbis to a project, you need to do a few things:



    You need to add the Ogg Vorbis include path to your project. To do this, select Settings from the Project menu, and go to the C/C++ Tab. Choose Preprocessor from the Category dropdown. In the Additional Include Directories edit box, type a relative path from your project to the include folder underneath where you installed Ogg Vorbis. For example, for this chapter's example program, I would enter ..\..\libvorbis-1.0\include.



    You need to link with the Ogg Vorbis libraries. To do this, go to the Link tab in the settings dialog, and select the Input category. In the edit box labeled Object/library modules, add the Ogg Vorbis libs you want to use. For this chapter's sample program, I've added vorbisfile_static.lib, ogg_static.lib, and vorbis_static.lib.



    You need to add the Ogg Vorbis library directory to your library path. In the same place, a couple of edit boxes below Object/library modules, is another edit box called Additional Library Path. Add the relative path to your Ogg Vorbis lib directory here. For the Ch8p1_OggVorbisPlayback sample program, this is ..\..\libvorbis-1.0\lib. Separate paths using commas.



    In your code, make sure you include the right Ogg Vorbis headers, and make sure you use vorbis/ in their path. For example, if you wanted to include vorbisfile.h, you'd type #include <vorbis/vorbisfile.h>. The preprocessor tacks this onto the relative path you added in step 1, so you will end up with something like ..\..\libvorbis-1.0\include\vorbis\vorbisfile.h.



/ 127