PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University. More...
#include "pandabase.h"
#include "audioSound.h"
#include "reMutex.h"
#include "fmodAudioManager.h"
#include <fmod.hpp>
#include <fmod_errors.h>
#include "fmodAudioSound.I"
Go to the source code of this file.
Classes | |
class | FmodAudioSound |
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
All rights reserved.
All use of this software is subject to the terms of the revised BSD license. You should have received a copy of this license along with this source code in a file named "LICENSE."
[FIRST READ FmodAudioManager for an Introduction if you haven't already].
Hello, all future Panda audio code people! This is my errata documentation to Help any future programmer maintain FMOD and PANDA.
Well, if you reading this you probably want to know how PANDA deals with sounds directly using FMOD-EX. Well I am going to tell you.
The first thing, you as the programmer have to understand, especially if you never have done sound programming before, is how the FMOD-EX API works.
With FMOD-EX the guys at Firelight, adopted a model of managing sounds with FMOD similar to how a Sound Designer creates sound in a sound studio using SOUNDS and CHANNELS. Although this may seem strange at first, if you are not familiar with sound programming, there is a very good metaphor you are probably already familiar with to explain how FMOD-EX works.
Think of you standard GUI API. Usually a GUI API is made up of two things: Windows and Widgets. These correspond to CHANNELS and SOUNDS, where a Channel is a Window and a Sound is Widget. Sounds are played within channels, and channels don't exist unless they have something to display.
Now why am I explaining all of this? When PANDA was created they set up the basic audio classes to handle only the idea of a SOUND. The idea of a Channel really wasn't prevalent as in more modern Audio APIs. With this rewrite of PANDA to use the FMOD-EX API, the PANDA FmodAudioSound Class, now has to handle two different parts of the FMOD-EX API in order to play a sound.
SOUND: The object the handles the audio data in form of WAV, AIF, OGG, MID, IT, MP3, etc... And CHANNEL: The object that actually plays the sound and manipulates it in real time.
Ultimately this isn't a problem expect for a couple situations when you go to play a sound, which I will explain in more detail in that part of the code. All that you have to know right now is that Channels in FMOD do not exist unless they are playing a sound. And in the PANDA FmodAudioSound API class there is only ONE dedicated channel per sound. Otherwise there is really nothing to worry about.
Definition in file fmodAudioSound.h.