« Return to Thread: suggestions on c++ game design with openAL most welcome

suggestions on c++ game design with openAL most welcome

by Pingwah Leronz :: Rate this Message:

Reply to Author | View in Thread

Some parts of this message have been removed. Learn more about Nabble's security policy.
First of all, hello everyone :)
 
 
I'm working on a c++ project that's moving into the early stages of audio design and facing what Im guessing would be a fairly common problem, and wondering if anyone has any advice or input about the best way to approach it.
 
For those interested -
Let's say we have a car
class classCar()
{
    public:
    classCoords coordsPosition;
    classCoords coordsVelocity;
    float fltFuel;
    ...etc.
 
};
 
where classCoords is simply
coords
{
  public:
  float x, y, z;
 
};
 
and Cars are to be able to emit several sounds at once , an ambient engine roar, horn beeps, drivers yelling etc.
Also there's to be literally millions of cars (OK, in the project itself , they're not cars :) ), so a method of culling sound emitters from the set needs to be there. 
Criteria for adding and removing Cars from the audio set is simply proximity to a viewing position, and the cars themselves are stored in something like
 
 
multimap <classCoord*, classCar*> mapCars;
 
(again, they're not cars- let's say the track consists of many discrete positions, each of which can contain many cars).
 
I've been experimenting with two methods of handling this - the first with a global controller:
 
Method 1
---------------------------------
class classAudioController()
{
     int MAX_SOUNDS = 150;
     multimap <classCar*, ALuint> mapSounds;     //where ALuint here is a ref to the standard openal source[MAX_SOURCES]
 
     //functions
     void AddCar(classCar* newCar, ALuint* newAudioSource);
     bool AssignBufferToSource(ALuint *intSource, ALbyte* filename);
     void UpdateAllPositionsAndVelocities();
     void UpdateCarsPositionAndVelocity(classCar* findCar);
     etc.
 
 
};
 
 
and also by a more object oriented
 
Method 2
----------------------------------
classCar
{
   //position, fuel, health etc.
   //....
   classAudioSource *soundSource[MAX_SOURCES];   //remember, each car can emit many simultaneous sounds
 
 
}
 
where classAudioSource is
{
   ALuint intSource
 
   //funcs
   bool AssignBufferToThis(ALbyte *filename);
   void UpdatePosition(float x, float y, float z);
   void Play();
   void Stop();
   void PitchMod(float fltMod);
   void GainMod(float fltMod);
   void SetLooping(bool boolLooping);
   
   etc.
 
}
 
 
 
With Method 1, Cars are added and removed from the emitters map on movement events, In method 2 classAudioSources are triggered to Play/Stop based on listener proximity , again on movement events.
I'm running into problems with both, mainly from unfamiliarity.
 
If anyone here has input into handling large sets of sound sources in a good OO-heavy way, or can point me to any reading that does I'd be massively grateful.
 
Thanks,
Pingwah
 
 
 
 
 


Find car news, reviews and more Looking to change your car this year?
_______________________________________________
Openal mailing list
Openal@...
http://opensource.creative.com/mailman/listinfo/openal

 « Return to Thread: suggestions on c++ game design with openAL most welcome