📄 oasisaudible.h
字号:
/******************************************************************************
* This source file is part of Bad Camel Gaming
* Copyright (C) 2003 Zephie Greyvenstein
* See Readme.html for acknowledgements
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*****************************************************************************/
/******************************************************************************
* FILENAME : oasisAudible.h
* DESCRIPTION : An audible object
* AUTHOR : Zephie Greyvenstein
*****************************************************************************/
/// Avoid double inclusion
#ifndef __AUDIBLE_H__
#define __AUDIBLE_H__
/// Include the common headers
#include "oasisCommon.h"
/// Include the rest of the needed oasis stuff
#include "oasisIterators.h"
namespace Oasis {
/** An audible object
@remarks
This object can have sounds attached to it as events
*/
class _oasisExport audible {
public:
/// Constructor
audible( );
/// Deconstructor
virtual ~audible( );
/// Sound list used by audible
typedef std::map< string, sound* > soundMap;
/// Gets an iterator to the sound events for this object
typedef mapIterator< soundMap > soundIterator;
/** Add a sound by creating it first..convienance
@remarks
You label sounds when adding them to an object, so you can play sounds
by label. This is handy for registering sounds for different events
and then being able to just call the event to play
*/
sound *addSound( const string &name, const string &templateName );
/** Add a sound that we have already created
@remarks
You label sounds when adding them to an object, so you can play sounds
by label. This is handy for registering sounds for different events
and then being able to just call the event to play
*/
void addSound( const string &name, sound *soundObject );
/// Get a sound event
sound *getSound( const string &name );
/// Play a sound event
sound *playSound( const string &name );
/// Stop a sound event
sound *stopSound( const string &name );
/// Stop all sounds attached to this object
void stopAllSounds( void );
/// Remove all sounds attached to this object
void removeAllSounds( void );
/// Remove and destroy all sounds attached to this object
void removeAndDestroyAllSounds( void );
/// Remove a sound event
void removeSound( const string &name );
/// Remove and destroy a sound event
void removeAndDestroySound( const string &name );
/// Get an iterator to the sound events for this object
soundIterator getSoundIterator( void );
protected:
/// Sounds attached to the object. This should be a hash_map
soundMap sounds;
/// Set a sound's position
void _setSoundPosition( sound *soundObject, const vector3 &newPosition );
/// Set all the sound's positions
void _setAllSoundPositions( const vector3 &newPosition );
/// When a new sound is introduced, it will get passed here for you to
/// do any extra init stuff
virtual void _processNewSound( sound *newSound ) = 0;
};
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -