Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    37
  • comments
    68
  • views
    46777

The project is Asylum.

Sign in to follow this  
coldacid

324 views

Well, I'm starting to get technical work done on a new first person adventure/horror game. I've even gotten a simple state machine up and running, although only one state really does anything (and it's the pause state, of all things). I'm working on an actual technical design beyond the usual "throw whatever works together".

In addition, I'm figuring to do an audio system similar to what OGRE offers, so that the game can take advantage of certain EAX features (such as multiple, finite environments simultaneously). Well, similar to what OGRE's RenderSystems offer; that is, multiple audio drivers with a shared interface, and a root to control them from.

I'm still figuring out what language should be used for any game scripting. I'm really leaning towards Ruby and Lua, in that order. What'd be best is setting up a basic environment, cloning it for each level, setting up any level-specific stuff, and then sandboxing to prevent any nasties. If I recall correctly, I can do that with Lua, but I'm not sure about Ruby.

Meldstar still needs design people, since I suck at anything beyond coming up with an original concept. The art of fleshing out an idea into a full-fledged game is foreign to me as I've recently come to admit, but as far as I can tell I'm still better than the rest of Meldstar at it. Sux.

Now, I gotta figure out how to make CEGUI and the Theora video plugin for OGRE play nice with the state machine system. Whee.
Sign in to follow this  


4 Comments


Recommended Comments

Majority by Zahlman.



audio.h
#if !defined(_AUDIOSYSTEM_H_INCLUDED_)

#define _AUDIOSYSTEM_H_INCLUDED_

#include <string>
#include <map>

#include <FMOD/fmod.h>
#include <FMOD/fmod_errors.h> // optional




namespace System {

class AudioItem;
class MusicItem;
class SoundItem;

extern MusicItem* currentMusic;

class CAudio {
public:
CAudio();
~CAudio();


void Close(std::string filename);

void Stop();
bool Stop(std::string filename);
void StopMusic();
int MusicVolume(int volume);

bool Load(std::string name, std::string filename, int type = 0);
void Play(std::string filename);
void Pause(std::string filename, bool pause);
bool Pause(std::string filename);
void Looping(std::string filename, bool looping);
bool Looping(std::string filename);

void Volume(int volume);
int Volume();
void Volume(std::string filename, int volume);
int Volume(std::string filename);
};

extern CAudio Audio;


/*****************************************************************/
class AudioItem
{
public:
virtual ~AudioItem() { }
virtual void Play() = 0;
virtual void Stop() = 0;
virtual void Close() = 0;
virtual bool Load(std::string) = 0;

// These functions only exist in Music
virtual void Pause(bool pause){ }
virtual bool Pause(){ return false; }
virtual bool Looping(){ return false; }
virtual void Looping(bool looping){ }

virtual void Volume(int volume) { }
virtual int Volume() { return 100; }

int type;
};


/*****************************************************************/
class SoundItem : public AudioItem
{
public:
SoundItem() : channel(-1), handle(NULL) { }
bool Load(std::string filename){
handle = FSOUND_Sample_Load(
FSOUND_FREE|FSOUND_UNMANAGED,
filename.c_str(), 0, 0, 0);
return handle != NULL;
}
void Stop() { FSOUND_StopSound(channel); }
void Play() {
if(handle)
channel = FSOUND_PlaySound(FSOUND_FREE, handle);
}
void Close() {
if(handle){
Stop();
FSOUND_Sample_Free(handle);
handle = NULL;
}
}
~SoundItem() { Close(); }

FSOUND_SAMPLE* Handle(){ return handle; }
private:
FSOUND_SAMPLE* handle;
int channel;
};


/*****************************************************************/


class MusicItem : public AudioItem
{
public:
MusicItem() : looping(true), handle(NULL) { }
bool Load(std::string filename){
handle = FMUSIC_LoadSong(filename.c_str());
return handle != NULL;
}
void Close(){
Stop();
if(handle){
FMUSIC_FreeSong(handle);
handle = NULL;
}
}
~MusicItem(){ Close(); }
void Play() {
if(handle){
if(currentMusic){
FMUSIC_StopSong(currentMusic->Handle());
}
currentMusic = this;
FMUSIC_PlaySong(handle);
}
}
void Stop() {
if(handle){
FMUSIC_StopSong(handle);
currentMusic = NULL;
}
}
void Pause(bool pause) {
if(handle)
FMUSIC_SetPaused(handle, pause);
}
bool Pause() {
if(handle)
return FMUSIC_GetPaused(handle);
else
return false;
}
bool Looping(){ return looping; }
void Looping(bool looping){
if(handle){
FMUSIC_SetLooping(handle, looping);
this->looping = looping;
}
}

Share this comment


Link to comment
Can you please stop pimping your audio system? I'm doing things quite differently since I want to actually take advantage of EAX in ways FMOD doesn't. In addition, the Theora plugin wants an audio class setup in a certain way.

As for the stuff with Lua, is that any different than what I already got off you during last semester?

Share this comment


Link to comment
Quote:
As for the stuff with Lua, is that any different than what I already got off you during last semester?
I have no clue... It is the latest source build though.

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!