"L. Spiro Engine"
Classes | Typedefs | Enumerations | Functions | Variables

lss Namespace Reference

Classes

class  CSoundLib
struct  oggpack_buffer
struct  ogg_page
struct  ogg_stream_state
struct  ogg_packet
struct  ogg_sync_state
class  COggWindow
 Ogg window functions. More...
struct  vorbis_info_floor0
struct  vorbis_info_floor1
struct  vorbis_func_residue
struct  vorbis_info_residue0
struct  vorbis_func_mapping
class  CVorbisBitrate
 Bitrate tracking and management. More...
class  CVorbisCodeBook
 Basic shared codebook operations. More...
class  CVorbisCodec
 The vorbis codec. More...
struct  private_state
struct  codec_setup_info
struct  vorbis_look_floor1
class  CVorbisConstants
 A few helper functions. More...
class  CVorbisEnvelope
 Vorbis PCM data envelope analysis and manipulation. More...
class  CVorbisFile
 Convenience library for opening/seeking/decoding. More...
class  CVorbisFloor0
 Floor backend 0 implementation. More...
class  CVorbisFloor1
 Floor backend 1 implementation. More...
class  CVorbisHighLevel
 High-level Vorbis structures. More...
class  CVorbisLpc
 LPC low level routines. More...
class  CVorbisLsp
 LSP (also called LSF) conversion routines. More...
class  CVorbisMapping0
 Channel mapping 0 implementation. More...
class  CVorbisMasking
 Masking curve data for psychoacoustics. More...
class  CVorbisMdct
 Modified discrete cosine transform prototypes. More...
class  CVorbisMisc
 Miscellaneous prototypes. More...
class  CVorbisOs
 Functions/types that change per compiler/operating system. More...
class  CVorbisPsy
 Random psychoacoustics (not including pre-echo). More...
class  CVorbisRegistry
 Registry for time, floor, res backends and channel mappings. More...
class  CVorbisRes0
 Residue backend 0, 1, and 2 implementation. More...
class  CVorbisSmallFt
 Fast Fourier transform. More...
class  CVorbisStructs
 Various structures from the Vorbis library that can't be placed anywhere else. More...
class  CSoundBuffer
 Shared raw sound data. More...
class  CSoundListener
 The listener hears all the sounds in the world. More...
class  CSoundSource
 Base functionality for sound sources. More...
struct  LSS_SOUND_SOURCE_LOAD_PARMS
class  CStaticSoundSource3d
class  CStreamingSoundSource
 A source used with streaming audio data. More...
class  IStreamingSoundSourceStreamer
 An interface for the retrieval of sound data for use by the CStreamingSoundSource class. More...
class  CSoundBufferEx
 Extending the sound buffer with the ability to load files. More...
struct  LSE_CORE_SFX_DATA
class  CWaveLoader
class  CWaveStreamingSoundSourceStreamer
 A way to stream audio data from .wav files. More...

Typedefs

typedef ALfloat LSSREAL
typedef struct
lss::oggpack_buffer
LPoggpack_buffer
typedef struct lss::oggpack_buffer LPCoggpack_buffer
typedef struct lss::ogg_pageLPogg_page
typedef struct lss::ogg_page LPCogg_page
typedef struct
lss::ogg_stream_state
LPogg_stream_state
typedef struct
lss::ogg_stream_state 
LPCogg_stream_state
typedef struct lss::ogg_packetLPogg_packet
typedef struct lss::ogg_packet LPCogg_packet
typedef struct
lss::ogg_sync_state
LPogg_sync_state
typedef struct lss::ogg_sync_state LPCogg_sync_state
typedef
IStreamingSoundSourceStreamer 
Parent
typedef struct
lss::vorbis_info_floor0
LPvorbis_info_floor0
typedef struct
lss::vorbis_info_floor0 
LPCvorbis_info_floor0
typedef struct
lss::vorbis_info_floor1
LPvorbis_info_floor1
typedef struct
lss::vorbis_info_floor1 
LPCvorbis_info_floor1
typedef struct
lss::vorbis_func_residue
LPvorbis_func_residue
typedef struct
lss::vorbis_func_residue 
LPCvorbis_func_residue
typedef struct
lss::vorbis_info_residue0
LPvorbis_info_residue0
typedef struct
lss::vorbis_info_residue0 
LPCvorbis_info_residue0
typedef struct
lss::vorbis_func_mapping
LPvorbis_func_mapping
typedef struct
lss::vorbis_func_mapping 
LPCvorbis_func_mapping
typedef struct lss::private_state private_state
typedef struct
lss::codec_setup_info 
codec_setup_info
typedef struct
lss::vorbis_look_floor1
LPvorbis_look_floor1
typedef struct
lss::vorbis_look_floor1 
LPCvorbis_look_floor1
typedef struct
lss::LSS_SOUND_SOURCE_LOAD_PARMS
LPLSS_SOUND_SOURCE_LOAD_PARMS
typedef struct
lss::LSS_SOUND_SOURCE_LOAD_PARMS 
LPCLSS_SOUND_SOURCE_LOAD_PARMS
typedef LSVOID(LSE_CALL * PfSoundEventHandler )(LSUINTPTR _uiptrUserPtr, CSoundSource *_pssSource, LSUINT32 _ui32EventType, CSoundManager *_psmManager)
typedef struct
lss::LSE_CORE_SFX_DATA
LPLSE_CORE_SFX_DATA
typedef struct
lss::LSE_CORE_SFX_DATA
LPCLSE_CORE_SFX_DATA

Enumerations

enum  LSS_VORBIS_ERRORS {
  OV_FALSE = -1, OV_EOF = -2, OV_HOLE = -3, OV_EREAD = -128,
  OV_EFAULT = -129, OV_EIMPL = -130, OV_EINVAL = -131, OV_ENOTVORBIS = -132,
  OV_EBADHEADER = -133, OV_EVERSION = -134, OV_ENOTAUDIO = -135, OV_EBADPACKET = -136,
  OV_EBADLINK = -137, OV_ENOSEEK = -138, LSS_VE_FORCEDWORD = 0x7FFFFFFF
}
enum  {
  NOTOPEN = 0, PARTOPEN = 1, OPENED = 2, STREAMSET = 3,
  INITSET = 4, CHUNKSIZE = 65536, READSIZE = 2048
}
enum  {
  VE_PRE = 16, VE_WIN = 4, VE_POST = 2, VE_AMP = (VE_PRE + VE_POST - 1),
  VE_BANDS = 7, VE_NEARDC = 15, VE_MINSTRETCH = 2, VE_MAXSTRETCH = 12
}
enum  LSS_VORBIS_BLOCK_SETTINGS { BLOCKTYPE_IMPULSE = 0, BLOCKTYPE_PADDING = 1, BLOCKTYPE_TRANSITION = 0, BLOCKTYPE_LONG = 1 }
enum  LSS_VORBIS_PACKET { PACKETBLOBS = 15 }
enum  LSS_VORBIS_BACKEND { VIF_POSIT = 63, VIF_CLASS = 16, VIF_PARTS = 31 }
enum  LSS_VORBIS_MASKING { MAX_ATH = 88, EHMER_OFFSET = 16, EHMER_MAX = 56 }
enum  LSS_CODE_BOOK { VQ_FEXP = 10, VQ_FMAN = 21, VQ_FEXP_BIAS = 768 }
enum  LSS_BLOCKS { WORD_ALIGN = 8 }
enum  LSS_REGISTRY {
  VI_TRANSFORMB = 1, VI_WINDOWB = 1, VI_TIMEB = 1, VI_FLOORB = 2,
  VI_RESB = 3, VI_MAPB = 1
}
enum  LSS_SOUND_SOURCE {
  LSS_SS_STATIC = 0x08000000, LSS_SS_3DSTATIC = 0x00000001, LSS_SS_2DSTATIC = 0x00000002, LSS_SS_1DSTATIC = 0x00000003,
  LSS_SS_STREAMING = 0x01000000, LSS_SS_3DSTREAMING = 0x00000004, LSS_SS_2DSTREAMING = 0x00000005, LSS_SS_1DSTREAMING = 0x00000006,
  LSS_SS_MASK = 0x00FFFFFF
}
enum  LSS_DATA_SOURCE_STREAMERS { LSS_DSS_BASE = (1UL << 0UL) }
enum  LSS_STREAMERTYPES { LSS_ST_WAVEFILE = (1UL << 1UL), LSS_ST_OGGFILE = (1UL << 2UL) }
enum  LSS_ERRORS { LSS_E_INVALID_BUFFER = 0 }
enum  LSS_EVENT_TYPES { LSS_ET_SOUND_JUST_STARTED, LSS_ET_SOUND_JUST_ENDED }

Functions

virtual LSBOOL LSE_CALL GetData (LSUINT64 _ui64From, LSUINT64 &_ui64Length, LSUINT8 *&_pui8Data, CAllocator *_paAllocator) const
virtual LSUINT32 LSE_CALL GetType () const
virtual const LSCHAR *LSE_CALL GetName () const
virtual LSUINT32 LSE_CALL GetFrequency () const
virtual LSUINT32 LSE_CALL GetBits () const
virtual LSUINT32 LSE_CALL GetChannels () const
virtual LSUINT64 LSE_CALL GetAudioLength () const
LSUINT32 LSE_CALL GetBufferId () const
virtual LSBOOL LSE_CALL Play (LSUINT32 _ui32LoopCount=1)
virtual LSBOOL LSE_CALL Pause ()
virtual LSBOOL LSE_CALL Stop ()
virtual LSBOOL LSE_CALL Static () const
virtual LSVOID LSE_CALL SetBuffer (const CSoundBuffer *_psbBuffer)
virtual LSVOID LSE_CALL Tick (LSUINT64 _ui64TimeSinceLastUpdate)
virtual LSBOOL LSE_CALL DeviceActivated ()
virtual LSVOID LSE_CALL UpdatePlayState ()
virtual LSVOID LSE_CALL ApplyStates ()
LSE_CALLCTOR CSoundManager ()
virtual LSVOID LSE_CALL SetAllocator (CAllocator *_paAllocator)
CAllocator *LSE_CALL GetAllocator ()
virtual LSBOOL LSE_CALL SetDevice (const LSCHAR *_pcDevice, CString *_pstrError=NULL)
LSVOID LSE_CALL Run ()
LSVOID LSE_CALL Tick ()
LSVOID LSE_CALL SynchronousUpdate (LSUINTPTR _uiptrUserPtr, PfSoundEventHandler _pfHandler)
virtual LSVOID LSE_CALL ResetAllSounds ()
virtual LSVOID LSE_CALL SoftReset ()
LSUINT32 LSE_CALL AddBuffer (const LSUINT8 *_pui8Data, LSUINT32 _ui32Length, LSUINT32 _ui32Freq, LSUINT32 _ui32Bits, LSUINT32 _ui32Channels, LSBOOL _bRetain=true, LSUINTPTR _uiptrUserData=0, CString *_pstrError=NULL)
LSVOID LSE_CALL RemBuffer (LSUINT32 _ui32Id)
LSUINT32 LSE_CALL RemAllUnreferencedBuffers ()
LSBOOL LSE_CALL AllReferencesToBufferAreStreaming (LSUINT32 _ui32BufferId) const
const CSoundBuffer *LSE_CALL FindBufferById (LSUINT32 _ui32Id) const
const CSoundBuffer *LSE_CALL FindBufferByIdAndLock (LSUINT32 _ui32Id) const
LSVOID LSE_CALL Lock () const
LSVOID LSE_CALL UnLock () const
CSoundListener &LSE_CALL GetListener ()
CSoundSource *LSE_CALL AddSourceAndLock (LSS_SOUND_SOURCE _ssType, const LSS_SOUND_SOURCE_LOAD_PARMS &_sslpParms, CString *_pstrError=NULL)
LSVOID LSE_CALL RemSource (LSUINT32 _ui32Id)
CSoundSource *LSE_CALL FindSourceById (LSUINT32 _ui32Id)
CSoundSource *LSE_CALL FindSourceByIdAndLock (LSUINT32 _ui32Id)
LSBOOL LSE_CALL AttachBufferToStaticSource (LSUINT32 _ui32SrcId, LSUINT32 _ui32BufferId)
LSBOOL LSE_CALL AttachBufferToStaticSource (CSoundSource *_pssSource, LSUINT32 _ui32BufferId)
LSVOID LSE_CALL StopAndDeleteAllStaticSources ()
LSVOID LSE_CALL SetListenerPos (const CVector3 &_svPos)
LSVOID LSE_CALL SetListenerVel (const CVector3 &_svVel)
LSVOID LSE_CALL SetListenerPosAndVel (const CVector3 &_svPos, const CVector3 &_svVel)
LSVOID LSE_CALL SetMasterVolume (LSSREAL _fVolume)
const CSoundListener &LSE_CALL GetListenerAndLock () const
virtual LSVOID LSE_CALL ResetDevice ()
virtual LSVOID LSE_CALL ShutDown ()
virtual CSoundBuffer *LSE_CALL NewBuffer (const LSUINT8 *_pui8Data, LSUINT32 _ui32Length, LSUINT32 _ui32Freq, LSUINT32 _ui32Bits, LSUINT32 _ui32Channels, LSBOOL _bRetain, LSUINTPTR _uiptrUserData) const
virtual LSVOID LSE_CALL DeleteBuffer (CSoundBuffer *&_psbBuffer) const
virtual CSoundSource *LSE_CALL NewSoundSource (LSS_SOUND_SOURCE _ssType, LSUINT32 _ui32Id) const
virtual LSVOID LSE_CALL DeleteSource (CSoundSource *&_pssSource) const
virtual LSBOOL LSE_CALL AddStreamer (IStreamingSoundSourceStreamer *_pssssSteamer)
LSUINT32 LSE_CALL GetStreamerIndex (const LSCHAR *_pcStreamerName) const
LSUINT32 LSE_CALL FindStreamerByName (const LSCHAR *_pcStreamerName) const
virtual LSVOID LSE_CALL DeleteStreamer (IStreamingSoundSourceStreamer *_pssssSteamer)=0
LSVOID LSE_CALL FindUniqueSourceId (CSoundSource *&_pssSource) const
LSUINT32 LSE_CALL CreateBuffer (const LSCHAR *_pcFile)
LSUINT32 LSE_CALL FindBufferByPath (const LSCHAR *_pwcPath) const
LSCHAR *LSE_CALL GetBufferPathById (LSUINT32 _ui32Id, LSCHAR *_pcRet) const
CStaticSoundSource3d *LSE_CALL Create3dStaticSoundSourceAndLock (const CVector3 &_vPos, LSREAL _fGain=LSM_ONE, LSREAL _fMaxDistance=static_cast< LSREAL >(256.0), const LSCHAR *_pcFile=NULL, LSUINT32 _ui32Id=0UL)
CStaticSoundSource2d *LSE_CALL Create2dStaticSoundSourceAndLock (const CVector2 &_vPos, LSREAL _fGain=LSM_ONE, const LSCHAR *_pcFile=NULL)
LSBOOL LSE_CALL RegisterWaveForStream (const LSCHAR *_pcFile)
LSBOOL LSE_CALL RegisterOggForStream (const LSCHAR *_pcFile)
LSBOOL LSE_CALL RegisterSoundForStream (const LSCHAR *_pcFile)
CStreamingSoundSource *LSE_CALL Create2dStreamSoundSourceAndLock (const LSCHAR *_pcName, const CVector2 &_vPos, LSREAL _fGain=LSM_ONE)
LSUINT32 LSE_CALL Play2dStreamEx (const LSCHAR *_pcName, const CVector2 &_vPos=CVector2(LSM_ZERO, LSM_ZERO), LSREAL _fGain=LSM_ONE, LSUINT32 _ui32Loop=CSoundSource::LSS_LM_INFINITE, LSBOOL _bOnlyPlayIfNotPlaying=true, LSBOOL _bClearAllStreamsIfPlayed=true)
LSUINT32 LSE_CALL SoundIsStreaming (const LSCHAR *_pcName) const
LSVOID LSE_CALL ClearAllStreamsExcept (LSUINT32 _ui32Id)

Variables

__pad0__
LSUINTPTR iov_len
LPogg_iovec_t
*const LPCogg_iovec_t
F CAllocator * _paAllocator
CVorbisFile::LSS_OV_FILE m_ovfFile
LSCHAR * m_pcPath
CAllocator * m_paAllocator
LSUINT64 m_ui64SoundTime
LSUINT64 m_ui64Pcms
CVorbisCodec::vorbis_infom_pviInfo
F COgg::oggpack_buffer
*CVorbisStructs::vorbis_info_floor(* 
unpack )(CVorbisCodec::vorbis_info *, COgg::oggpack_buffer *)
CVorbisStructs::vorbis_look_floor *(* look )(CVorbisCodec::vorbis_dsp_state *, CVorbisStructs::vorbis_info_floor *)
LSVOID(* free_info )(CVorbisStructs::vorbis_info_floor *)
LSVOID(* free_look )(CVorbisStructs::vorbis_look_floor *)
LSVOID *(* inverse1 )(CVorbisCodec::vorbis_block *, CVorbisStructs::vorbis_look_floor *)
LSINT32(* inverse2 )(CVorbisCodec::vorbis_block *, CVorbisStructs::vorbis_look_floor *, LSVOID *buffer, LSFLOAT *)
LPvorbis_func_floor
*const LPCvorbis_func_floor
LSFLOAT ampmax
LSINT32 blocktype
COgg::oggpack_buffer * packetblob [PACKETBLOBS]
LPvorbis_block_internal
*const LPCvorbis_block_internal
const CSoundBufferm_psbBuffer
LSBOOL m_bPlayStateDirty
CCriticalSection m_csCriticalSection
LSBOOL m_bAllocatorIsPrivate
LSINT32 m_i32LockCount
CTime m_tTime
volatile LSBOOL m_bRun
LSH_THREAD m_hThread
ALCdevice * m_pdDevice
ALCcontext * m_pcContext
CVectorPoD< CSoundBuffer
*, LSUINT32 > 
m_psbBuffers
CMap< LSUINT32, CSoundSource * > m_pssSources
CVectorPoD
< IStreamingSoundSourceStreamer * > 
m_pssssStreamers
CSoundListener m_slListener
CVectorPoD< LSE_CORE_SFX_DATAm_csdSfxData

Detailed Description

Copyright L. Spiro 2011 All rights reserved.

Written by: Shawn (L. Spiro) Wilcoxen

This code may not be sold or traded for any personal gain without express written consent. You may use this code in your own projects and modify it to suit your needs as long as this disclaimer remains intact. You may not take credit for having written this code.

Description: Uses the IStreamingSoundSourceStreamer interface to provide a way to stream audio data from an Ogg file into a CStreamingSoundSource object.

Copyright L. Spiro 2011 All rights reserved.

Written by: Shawn (L. Spiro) Wilcoxen

This code may not be sold or traded for any personal gain without express written consent. You may use this code in your own projects and modify it to suit your needs as long as this disclaimer remains intact. You may not take credit for having written this code.

Description: The Vorbis and Ogg libraries are extremely messy. The locations of certain structures is fairly illogical, functions that are declared in a single header are defined in multiple translation units, and #include's are thrown around everywhere, not just at the tops of files. Circular dependencies are created all over the place when the code is restructured properly. To eliminate this, we place some structures that do not rely on any other structures in this class/file.

Copyright L. Spiro 2011 All rights reserved.

Written by: Shawn (L. Spiro) Wilcoxen

This code may not be sold or traded for any personal gain without express written consent. You may use this code in your own projects and modify it to suit your needs as long as this disclaimer remains intact. You may not take credit for having written this code.

Description: Buffers are the shared sound data. Load a WAV or OGG (etc.) file and its raw PCM data will be held in a buffer which sound sources (CSoundSource) can use to play. This is shared data, following exactly the same concept as with 3D models, which are loaded once and then instanced. This class forms the shared sound data and CSoundSource forms the instances of the sound data played at various locations in the game world. This class cannot be instanced directly. Use CSoundManager to create instances of these.

There are 2 possible system states when these objects are created: One where there is a valid device already set and one without a valid device. Additionally, these buffers must support changing devices during run-time. Normally we could impose a restriction that requires a device to be set when buffers are created, but the fact is, because we need a system that allows changing devices anyway, it becomes very simple to modify the class just slightly so that it can handle both cases instead of only one. This allows us to impose no restrictions on the device state with no extra development time. Nice!

When the buffer is created it will be given a pointer to data which it will copy and store. The buffer can be set to keep the copy for forever or to free it once it has sent the copy to the hardware. Creating a buffer does not automatically make it try to send anything to hardware. The sound manager will, as soon as a device is ready (which will be immediately if there is already a device) notify the buffer that there is a device, and the buffer will then upload its contents. If set to free its copy it will do so then. The same notification is used to tell the buffer that a new device has been set, and the buffer will react the same way by uploading and optionally freeing its copy.

When the buffer needs to upload its copy to the hardware, it may have a NULL copy as a result of having uploaded and freed it previously. In this case the buffer calls the virtual function GetOriginalData(). the default implementation returns failure and the re-upload will fail. Therefore, if this class is not subclassed, and the user has the ability to change devices, the buffers must never be set to automatically free their copies. If the device can be changed, in order to save RAM this class should be subclassed so that the buffers may be flushed after being sent to the sound system.

Copyright L. Spiro 2011 All rights reserved.

Written by: Shawn (L. Spiro) Wilcoxen

This code may not be sold or traded for any personal gain without express written consent. You may use this code in your own projects and modify it to suit your needs as long as this disclaimer remains intact. You may not take credit for having written this code.

Description: The listener hears all the sounds in the world. There is only one listener in the game at a time. The gain property controls the master volume of all sound in the game.

Copyright L. Spiro 2011 All rights reserved.

Written by: Shawn (L. Spiro) Wilcoxen

This code may not be sold or traded for any personal gain without express written consent. You may use this code in your own projects and modify it to suit your needs as long as this disclaimer remains intact. You may not take credit for having written this code.

Description: Base functionality for sound sources. Sources are like instances of 3D models. The shared data is part of the CSoundBuffer class and this class maintains references to them. This class is just the base class for sound sources. There are 2 types of sources: static and streaming. They connect to buffers differently (actually streaming uses its own buffers), but share all of the same properties. This class provides all of the similar properties and the CStaticSoundSource and CStreamingSoundSource inherit from this and add their own methods for connecting to buffers.

Copyright L. Spiro 2011 All rights reserved.

Written by: Shawn (L. Spiro) Wilcoxen

This code may not be sold or traded for any personal gain without express written consent. You may use this code in your own projects and modify it to suit your needs as long as this disclaimer remains intact. You may not take credit for having written this code.

Description: Parameters passed when creating a sound source. This is easier to extend and pass than a bunch of parameters.

Copyright L. Spiro 2011 All rights reserved.

Written by: Shawn (L. Spiro) Wilcoxen

This code may not be sold or traded for any personal gain without express written consent. You may use this code in your own projects and modify it to suit your needs as long as this disclaimer remains intact. You may not take credit for having written this code.

Description: DESCRIPTION.

Copyright L. Spiro 2011 All rights reserved.

Written by: Shawn (L. Spiro) Wilcoxen

This code may not be sold or traded for any personal gain without express written consent. You may use this code in your own projects and modify it to suit your needs as long as this disclaimer remains intact. You may not take credit for having written this code.

Description: A static sound emenating from somewhere in the world. The world positions are not defined here. Does not use streaming.

Copyright L. Spiro 2011 All rights reserved.

Written by: Shawn (L. Spiro) Wilcoxen

This code may not be sold or traded for any personal gain without express written consent. You may use this code in your own projects and modify it to suit your needs as long as this disclaimer remains intact. You may not take credit for having written this code.

Description: A static sound emenating from somewhere in a 3D world. Does not use streaming. The source is not relative to the listener.

Copyright L. Spiro 2011 All rights reserved.

Written by: Shawn (L. Spiro) Wilcoxen

This code may not be sold or traded for any personal gain without express written consent. You may use this code in your own projects and modify it to suit your needs as long as this disclaimer remains intact. You may not take credit for having written this code.

Description: A 2D streaming sound source. Typically used for background music. All streaming sounds default to resisting soft resets, so this stream is prepared to continue playing across state changes, until manually stopped.

Copyright L. Spiro 2011 All rights reserved.

Written by: Shawn (L. Spiro) Wilcoxen

This code may not be sold or traded for any personal gain without express written consent. You may use this code in your own projects and modify it to suit your needs as long as this disclaimer remains intact. You may not take credit for having written this code.

Description: A streaming sound source needs an abstract way to stream data from a source (file/memory/ network/etc.) This class provides an interface for the retrieval of sound data for use by the CStreamingSoundSource class.

Copyright L. Spiro 2011 All rights reserved.

Written by: Shawn (L. Spiro) Wilcoxen

This code may not be sold or traded for any personal gain without express written consent. You may use this code in your own projects and modify it to suit your needs as long as this disclaimer remains intact. You may not take credit for having written this code.

Description: Adding the ability to load data from files to the sound engine. We use the user parameter passed to the constructor (_uiptrUserData) as a LSCHAR * indicating the file to load. The name of the file is copied locally.

Copyright L. Spiro 2011 All rights reserved.

Written by: Shawn (L. Spiro) Wilcoxen

This code may not be sold or traded for any personal gain without express written consent. You may use this code in your own projects and modify it to suit your needs as long as this disclaimer remains intact. You may not take credit for having written this code.

Description: Add more streamer types, because the core sound engine only defines the base streaming type which cannot even be instanciated.

Copyright L. Spiro 2011 All rights reserved.

Written by: Shawn (L. Spiro) Wilcoxen

This code may not be sold or traded for any personal gain without express written consent. You may use this code in your own projects and modify it to suit your needs as long as this disclaimer remains intact. You may not take credit for having written this code.

Description: The basic manager for sound throughout the engine. This is the hotspot that organizes and manages all sound resources, sound objects, and sound devices.

Run() and Stop() should be called from the same thread.

Copyright L. Spiro 2011 All rights reserved.

Written by: Shawn (L. Spiro) Wilcoxen

This code may not be sold or traded for any personal gain without express written consent. You may use this code in your own projects and modify it to suit your needs as long as this disclaimer remains intact. You may not take credit for having written this code.

Description: Add our own functionality to the sound library. We extend it to support loading of files and a few special effects. We also make it easy to play sounds and include the ability to delay-load sounds and perform automatic unloading of sounds.

Copyright L. Spiro 2011 All rights reserved.

Written by: Shawn (L. Spiro) Wilcoxen

This code may not be sold or traded for any personal gain without express written consent. You may use this code in your own projects and modify it to suit your needs as long as this disclaimer remains intact. You may not take credit for having written this code.

Description: Loads a wave file to RAM using the given allocator. Returns information regarding the loaded file.

Copyright L. Spiro 2011 All rights reserved.

Written by: Shawn (L. Spiro) Wilcoxen

This code may not be sold or traded for any personal gain without express written consent. You may use this code in your own projects and modify it to suit your needs as long as this disclaimer remains intact. You may not take credit for having written this code.

Description: Uses the IStreamingSoundSourceStreamer interface to provide a way to stream audio data from a wave file into a CStreamingSoundSource object.


Typedef Documentation

Setup information.

Parameters passed when creating a sound source. This is easier to extend and pass than a bunch of parameters.

Ogg packet. Used to encapsulate the data and metadata belonging to a single raw Ogg/Vorbis packet.

typedef struct lss::ogg_page * lss::LPogg_page

Ogg page. Used to encapsulate the data in one Ogg bitstream page.

Ogg sync state.

Ogg pack buffer.

Undocumented Vorbis structure.

Undocumented Vorbis structure.

Undocumented Vorbis structure.

Undocumented Vorbis structure.

Undocumented Vorbis structure.

Undocumented Vorbis library structure.

typedef LSVOID(LSE_CALL * lss::PfSoundEventHandler)(LSUINTPTR _uiptrUserPtr, CSoundSource *_pssSource, LSUINT32 _ui32EventType, CSoundManager *_psmManager)

Callback function prototype to handle sound events synchronously.

Parameters:
_uiptrUserPtrUser data passed to the synchronous update routine in the sound manager.
_pssSourceThe sound source that raised the event.
_ui32EventTypeThe type of event raised.
_psmManagerA pointer to the sound manager that owns the sound.

Private state.


Enumeration Type Documentation

anonymous enum

File library values.

anonymous enum

Envelope settings.

Blocks.

Codebook.

Types of data-source streamers. Extend this to add custom ones.

Error conditions.

Event types.

Registry.

The types of sound sources there are.

Add more streamer types, because the core sound engine only defines the base streaming type which cannot even be instanciated.

Backend settings.

Block settings.

Vorbis error codes.

Masking.

Packet settings.


Function Documentation

LSUINT32 LSE_CALL lss::AddBuffer ( const LSUINT8 *  _pui8Data,
LSUINT32  _ui32Length,
LSUINT32  _ui32Freq,
LSUINT32  _ui32Bits,
LSUINT32  _ui32Channels,
LSBOOL  _bRetain = true,
LSUINTPTR  _uiptrUserData = 0,
CString *  _pstrError = NULL 
)

Add a buffer with the given data. No device needs to be set. The data will be uploaded to the hardware when a device is available. Returns the ID of the buffer or CSoundBuffer::LSS_E_INVALID_BUFFER. _uiptrUserData is user data to be supplied to the created buffer. It has no meaning in the context of this library. Use it to pass special application-specific data to a custom (subclassed) CSoundBuffer object such as a file name etc. ** Must not be locked.

Parameters:
_pui8DataThe buffer data.
_ui32LengthNumber of bytes in the buffer.
_ui32FreqFrquency of the buffer.
_ui32BitsBuffer bit count.
_ui32ChannelsNumber of channels in the buffer.
_bRetainIf true, the buffer will keep a copy of the buffer even after it has sent it to the hardware. This uses more RAM, but if the device is lost the buffer can reset its data on its own.
_uiptrUserDataUser data.
_pstrErrorHolds the optional returned error string if an error occurs.
Returns:
Returns the ID of the buffer or CSoundBuffer::LSS_E_INVALID_BUFFER.
CSoundSource* LSE_CALL lss::AddSourceAndLock ( LSS_SOUND_SOURCE  _ssType,
const LSS_SOUND_SOURCE_LOAD_PARMS &  _sslpParms,
CString *  _pstrError = NULL 
)

Add a source with the given data. No buffer is attached to the source at this point, and the source cannot yet be used to play sounds. Returns the pointer to the created source. If the returned pointer is not NULL, you must call UnLock() when you are done with the returned pointer.

Parameters:
_ssTypeThe type of the source to create. Can be LSS_SS_3DSTATIC, LSS_SS_2DSTATIC, LSS_SS_1DSTATIC LSS_SS_3DSTREAMING, LSS_SS_2DSTREAMING, or LSS_SS_1DSTREAMING.
_sslpParmsParameters to apply to the loaded source.
_pstrErrorIf not NULL and there is an error creating the source, this will be filled with the error text.
Returns:
Returns a pointer to the added source or NULL upon failure. If NULL is returned, do not call UnLock().
virtual LSBOOL LSE_CALL lss::AddStreamer ( IStreamingSoundSourceStreamer *  _pssssSteamer) [protected, virtual]

Add a streamer to our internal list of streamers. If the streamer does not have a unique name, the results are unpredictable when later referencing this streamer by name.

The streamer to add. Must have been created externally.

Returns:
Returns true if there is enough memory to add the streamer.
LSBOOL LSE_CALL lss::AllReferencesToBufferAreStreaming ( LSUINT32  _ui32BufferId) const

Determine if all references to a buffer are from streaming sources.

Parameters:
_ui32BufferIdThe buffer ID to check.
Returns:
Returns false if any static sources reference the given buffer ID.
LSVOID LSE_CALL lss::ApplyStates ( ) [protected, virtual]

Apply states to the hardware or sound system (OpenAL for example). Does not clear the dirty flag.

LSBOOL LSE_CALL lss::AttachBufferToStaticSource ( LSUINT32  _ui32SrcId,
LSUINT32  _ui32BufferId 
)

Attach a buffer to a static source. Does not need to be locked. Returns false if the attachment was not made for any reason (source or buffer ID's are invalid).

Parameters:
_ui32SrcIdID of the source.
_ui32BufferIdID of the buffer to attach to the source.
Returns:
Returns true if both ID's are valid.
LSBOOL LSE_CALL lss::AttachBufferToStaticSource ( CSoundSource *  _pssSource,
LSUINT32  _ui32BufferId 
)

Attach a buffer to a static source. Returns false if the attachment was not made for any reason (source is not static or buffer ID is invalid). ** Must be locked.

Parameters:
_pssSourceSource to which to attach the buffer.
_ui32BufferIdID of the buffer to attach to the source.
Returns:
Returns true if the buffer ID is valid.
LSVOID LSE_CALL lss::ClearAllStreamsExcept ( LSUINT32  _ui32Id)

Clear all straming sounds whose ID's do not match the given ID.

Parameters:
_ui32IdID of the sound not to clear.
CStaticSoundSource2d* LSE_CALL lss::Create2dStaticSoundSourceAndLock ( const CVector2 &  _vPos,
LSREAL  _fGain = LSM_ONE,
const LSCHAR *  _pcFile = NULL 
)

Load (but do not play) a sound at a specified 2D location. The loaded sound is returned and UnLock() must be called when the sound pointer is no longer needed (after all settings have been applied to it). If the given file has not been loaded, it is loaded. The buffer to be associated with the source is optional; if provided the file will automatically be loaded (if not already) and added as a buffer. Common parameters for 2D sounds are provided here. Others can be set via the returned pointer.

Parameters:
_vPosThe 2D position of the source.
_fGainThe volume of the source from 0 to 1 inclusive.
_pcFileThe file containing the sound for this source. If already loaded, the existing buffer is used.
Returns:
Returns a pointer to the created 2D static source or NULL on error. If not NULL, call UnLock() when done with the pointer.
CStreamingSoundSource* LSE_CALL lss::Create2dStreamSoundSourceAndLock ( const LSCHAR *  _pcName,
const CVector2 &  _vPos,
LSREAL  _fGain = LSM_ONE 
)

Stream a 2D sound. The sound is referenced by name. If registered with Register*ForStream(), the name is the file path. ** Must not be locked.

Parameters:
_pcNameName of the registered stream to begin playing.
Returns:
Returns the created streaming sound if successful, NULL otherwise. If NULL is not returned, UnLock() must be called when done with the pointer.
CStaticSoundSource3d* LSE_CALL lss::Create3dStaticSoundSourceAndLock ( const CVector3 &  _vPos,
LSREAL  _fGain = LSM_ONE,
LSREAL  _fMaxDistance = static_cast< LSREAL >(256.0),
const LSCHAR *  _pcFile = NULL,
LSUINT32  _ui32Id = 0UL 
)

Load (but do not play) a sound at a specified 3D location. The loaded sound is returned and UnLock() must be called when the sound pointer is no longer needed (after all settings have been applied to it). If the given file has not been loaded, it is loaded. The buffer to be associated with the source is optional; if provided the file will automatically be loaded (if not already) and added as a buffer. Common parameters for 3D sounds are provided here. Others can be set via the returned pointer.

Parameters:
_vPosThe 3D position of the source.
_fGainThe volume of the source from 0 to 1 inclusive.
_fMaxDistanceMaximum distance at which the source can be heard.
_pcFileThe file containing the sound for this source. If already loaded, the existing buffer is used.
_ui32IdThe unique ID for this sound source or 0 to have a new ID generated. Unique ID's begin at LSS_UNIQUE_ID. If a sound source with the given unique ID exists it will be stopped and deleted, unless NULL is returned.
Returns:
Returns a pointer to the created 3D static source or NULL on error. If not NULL, call UnLock() when done with the pointer.
LSUINT32 LSE_CALL lss::CreateBuffer ( const LSCHAR *  _pcFile)

Create a buffer from a file. If the buffer has already been created, no operation is performed. ** Must not be locked.

Parameters:
_pcFileSound file to load.
Returns:
Returns the ID of the buffer on success, or 0 on failure.
LSVOID LSE_CALL lss::DeleteBuffer ( CSoundBuffer *&  _psbBuffer) const [protected, virtual]

Destroy a buffer the same way it was created.

Parameters:
_psbBufferThe buffer to destroy.
LSVOID LSE_CALL lss::DeleteSource ( CSoundSource *&  _pssSource) const [protected, virtual]

Destroy a sound source the same way it was created.Destroy a sound source the same way it was created.

Parameters:
_pssSourceThe sound source to destroy.

Destroy a sound source the same way it was created.

Parameters:
_pssSourceThe sound source to delete.
LSVOID LSE_CALL lss::DeleteStreamer ( IStreamingSoundSourceStreamer *  _pssssSteamer) [protected, pure virtual]

Creation of the streamers is done by the overriding class. Thus deletion must also be handled by them.

Parameters:
_pssssSteamerThe streamer to be deleted.
LSBOOL LSE_CALL lss::DeviceActivated ( ) [protected, virtual]

Notifies us that the given device has become active and we should send our buffer to it. A return of false from this function indicates the buffer could not be uploaded. This is considered a critical error by the engine.

Returns:
Returns true if the buffer could be reloaded.

A device has been created. We can register with the hardware. The sound manager notifies us of this event after the device has been changed. If there is a device already when we are created, we are notified via this function immediately after being created.

Returns:
Returns false if there is an error uploading our sound data to the hardware.
const CSoundBuffer* LSE_CALL lss::FindBufferById ( LSUINT32  _ui32Id) const

Find a buffer given its ID. Uses a binary search. ** Must be locked.

Parameters:
_ui32IdThe ID of the buffer to be found.
Returns:
Returns a pointer to the buffer if found, NULL otherwise.
const CSoundBuffer* LSE_CALL lss::FindBufferByIdAndLock ( LSUINT32  _ui32Id) const

Find a buffer given its ID. Uses a binary search. If the buffer pointer is returned, this object remains locked. When done with the returned pointer, call UnLock(). The returned pointer must not be used after calling UnLock().

Parameters:
_ui32IdThe ID of the buffer to be found.
Returns:
Returns a pointer to the buffer if found, NULL otherwise. If NULL is returned, do not call UnLock().
LSUINT32 LSE_CALL lss::FindBufferByPath ( const LSCHAR *  _pwcPath) const

Find a buffer by path.

Parameters:
_pwcPathThe path for which to search the loaded buffers.
Returns:
Returns the buffer ID or 0 on failure.
CSoundSource* LSE_CALL lss::FindSourceById ( LSUINT32  _ui32Id)

Get a source by ID. If found, returns a pointer to the source. If not found, NULL is returned. ** Must be locked.

Parameters:
_ui32IdID of the source to find.
Returns:
Returns the found source or NULL.
CSoundSource* LSE_CALL lss::FindSourceByIdAndLock ( LSUINT32  _ui32Id)

Same as FindSourceById(), except that it automatically locks the sound manager. If NULL is returned, the sound manager is unlocked. If a pointer is returned, the sound manager must be unlocked as soon as the pointer is done being used.

Parameters:
_ui32IdID of the source to find.
Returns:
Returns the found source or NULL.
LSUINT32 LSE_CALL lss::FindStreamerByName ( const LSCHAR *  _pcStreamerName) const [protected]

Find a streamer by name. Performs a binary search

Parameters:
_pcNamethe name of the streamer to find.
Returns:
Returns the index of the found streamer or ~0UL if none is found.
LSVOID LSE_CALL lss::FindUniqueSourceId ( CSoundSource *&  _pssSource) const [protected]

Find a unique ID and assign it to the given sound source. If no ID could be found, the sound source is deleted.

Parameters:
_pssSourceThe sound source for which to find a unique ID.
CAllocator* LSE_CALL lss::GetAllocator ( )

Get our allocator.

Returns:
Returns the allocator used by the sound manager.

Gets our allocator.

Returns:
Returns our allocator.

Get our allocator.

Returns:
Returns a pointer to the allocator used by this object.
virtual LSUINT64 LSE_CALL lss::GetAudioLength ( ) const [virtual]

Get the length of the data in microseconds.

Returns:
Returns the length, in microseconds, of the audio provided by this class.
virtual LSUINT32 LSE_CALL lss::GetBits ( ) const [virtual]

Get the number of bits per channel of the data.

Returns:
Returns the number of bits per channel of the data provided by this class.
LSUINT32 LSE_CALL lss::GetBufferId ( ) const

Get the ID of the buffer we reference, if any.

Returns:
Returns the unique ID of the buffer we reference, or CSoundSource::LSS_E_INVALID_BUFFER if there is none.
LSCHAR* LSE_CALL lss::GetBufferPathById ( LSUINT32  _ui32Id,
LSCHAR *  _pcRet 
) const

Get a buffer path by buffer ID. _pcRet must be at least LSF_MAX_PATH characters long.

Parameters:
_ui32IdID of the buffer whose path is to be returned.
_pcRetThe string to be filled with the returned path, if any.
Returns:
Returns NULL if the ID is invalid or if the buffer was not created via a path, otherwise _pcRet is filled with the path and returned.
virtual LSUINT32 LSE_CALL lss::GetChannels ( ) const [virtual]

Get the number of channels of the data.

Returns:
Returns the number of channels of the data provided by this class.
virtual LSBOOL LSE_CALL lss::GetData ( LSUINT64  _ui64From,
LSUINT64 &  _ui64Length,
LSUINT8 *&  _pui8Data,
CAllocator *  _paAllocator 
) const [virtual]

Retrieve sound data for use by the CStreamingSoundSource class.

Parameters:
_ui64FromThe offset within the data source to get the data, in microseconds.
_ui64LengthThe length of the data to get, in microseconds. If the function succeeds, this holds the returned length of the data in bytes.
_pui8DataThe returned data.
_paAllocatorThe allocator to be used to allocate the data to which _pui8Data will point on a successful return.
Returns:
Returns true if successful, false otherwise.
virtual LSUINT32 LSE_CALL lss::GetFrequency ( ) const [virtual]

Get the frequency of the data.

Returns:
Returns the frequency of the data provided by this class.
CSoundListener& LSE_CALL lss::GetListener ( )

Get the listener. This allows reading and writing, so you can set its position/volume/etc. directly. Changes will take place on the next tick of the sound manager. ** Must be locked.

Returns:
Returns a reference to the listener that can be used to modify its state.
CSoundListener &LSE_CALL lss::GetListenerAndLock ( ) const

Get the listener for read only. Must call UnLock() when done with the listener!

Returns:
Returns the lister.

Get the listener for read and write. Must call UnLock() when done with the listener!

Returns:
Returns the lister.
virtual const LSCHAR* LSE_CALL lss::GetName ( ) const [virtual]

Get the name of the streamer. Here it is the file path.

Returns:
Returns a constant LSCHAR * to the name of the streamer.
LSUINT32 LSE_CALL lss::GetStreamerIndex ( const LSCHAR *  _pcStreamerName) const [protected]

Get the index in the streamer list where a streamer with the given name should be added.

Parameters:
_pcStreamerNameName of the streamer whose index is to be located.
Returns:
Returns the index in the streamer list where a streamer with the given name should be added.
LSS_SOUND_SOURCE LSE_CALL lss::GetType ( ) const [virtual]

Get the type of this streamer. Returns LSS_ST_OGGFILE along with the parent type.

Returns:
Returns the bitmask representing the type of streamer this instance is.

Get the type of this source.

Returns:
Returns one of the LSS_SOUND_SOURCE values.
LSVOID LSE_CALL lss::Lock ( ) const

Lock this object for thread-safe access to its contents. Accessing buffers, sources, and the listener while not locked will result in failure.

CSoundBuffer *LSE_CALL lss::NewBuffer ( const LSUINT8 *  _pui8Data,
LSUINT32  _ui32Length,
LSUINT32  _ui32Freq,
LSUINT32  _ui32Bits,
LSUINT32  _ui32Channels,
LSBOOL  _bRetain,
LSUINTPTR  _uiptrUserData 
) const [protected, virtual]

Create a new buffer. If you subclass CSoundBuffer, you must override this to create the class of your new type. This function's job is only to create instances of buffer objects. This function does not link them to the list of buffers, etc.

Parameters:
_pui8DataThe buffer data.
_ui32LengthNumber of bytes in the buffer.
_ui32FreqFrquency of the buffer.
_ui32BitsBuffer bit count.
_ui32ChannelsNumber of channels in the buffer.
_bRetainIf true, the buffer will keep a copy of the buffer even after it has sent it to the hardware. This uses more RAM, but if the device is lost the buffer can reset its data on its own.
_uiptrUserDataUser data.
Returns:
Returns a pointer to the created sound buffer.

Use extended buffers we have the ability to get data from files when needed (when the device changes).

Parameters:
_pui8DataSound data to pass to the buffer.
_ui32LengthLength, in bytes, of the data passed to the buffer.
_ui32FreqFrequency of the data passed to the sound buffer.
_ui32BitsBits per channel of the data passed to the sound buffer.
_ui32ChannelsChannels in the data passed to the sound buffer.
_bRetainIf true, the buffer will keep a local copy of the data. Otherwise it will dump it after sending it to the hardware to save memory.
_uiptrUserDataA character pointer to a string indicating the path from which the buffer was created.
Returns:
Returns true if a new buffer could be created.
CSoundSource *LSE_CALL lss::NewSoundSource ( LSS_SOUND_SOURCE  _ssType,
LSUINT32  _ui32Id 
) const [protected, virtual]

Create a new source. There are a few types of sources. If you want to add more, override this function in a subclass and add them. This function's only job is to create the instances. It does not link them to the master list etc.

Parameters:
_ssTypeType of source to create.
_ui32IdId of the sound to create. 0 is used to generate a unique ID.
Returns:
Returns a pointer to the created sound source.

Create extended sound sources not available in the case sound manager.

Parameters:
_ssTypeThe type of sound source to create.
_ui32IdId of the sound to create. 0 is used to generate a unique ID.
Returns:
Returns a pointer to the created sound source of the given type.
virtual LSBOOL LSE_CALL lss::Pause ( ) [virtual]

Pause the sound. If there is no buffer, returns false.

Returns:
Returns true if a buffer has been assigned to this source.
virtual LSBOOL LSE_CALL lss::Play ( LSUINT32  _ui32LoopCount = 1) [virtual]

Begin playing the sound. If there is no buffer, returns false. The sound plays regardless of whether or not there is a sound device. If there is no sound device, the sound will begin playing at the correct position when a device becomes active. The sound begins playing on the next tick event.

Parameters:
_ui32LoopCountNumber of times to loop the sound.
Returns:
Returns true if the play was successful. A return of false indicates that no buffer was applied to this source.
LSUINT32 LSE_CALL lss::Play2dStreamEx ( const LSCHAR *  _pcName,
const CVector2 &  _vPos = CVector2(LSM_ZERO, LSM_ZERO),
LSREAL  _fGain = LSM_ONE,
LSUINT32  _ui32Loop = CSoundSource::LSS_LM_INFINITE,
LSBOOL  _bOnlyPlayIfNotPlaying = true,
LSBOOL  _bClearAllStreamsIfPlayed = true 
)

Play a registered stream at a given 2D position. Returns the ID of the created sound source which can be used to make modifications to the sound after loading. ** Must not be locked.

Parameters:
_pcNameName of the stream, previously registered with a call to Register*ForStream() to play.
_vPosPosition where to play the stream.
_fGainThe volume of the source from 0 to 1 inclusive.
_ui32LoopThe number of times to loop the sound.
_bOnlyPlayIfNotPlayingIf true, the sound will not play if already being played.
_bClearAllStreamsIfPlayedIf true, and the sound is actually played, all other streaming sounds will be stopped.
Returns:
The ID of the created source is returned, which can be used to make modifications to the sound after loading.
LSBOOL LSE_CALL lss::RegisterOggForStream ( const LSCHAR *  _pcFile)

Register a streaming sound in an Ogg file. The file must be a valid .ogg file.

Parameters:
_pcFileThe UTF-8 path to the file.
Returns:
Returns true if the sound was created.
LSBOOL LSE_CALL lss::RegisterSoundForStream ( const LSCHAR *  _pcFile)

Register a streaming sound in a supported sound file. The file must be a valid sound file.

Parameters:
_pcFileThe UTF-8 path to the file.
Returns:
Returns true if the sound was created.
LSBOOL LSE_CALL lss::RegisterWaveForStream ( const LSCHAR *  _pcFile)

Play a sound effect at a given 3D position using a returned ID from a registered LSE_SFX_DATA structure. Buffer is loaded if not loaded already. Loop count and expiration dates are set according to the data registered with the system.

Parameters:
_ui32SfxIdThe ID of the registered sound effect containing the parameters for playing the sound.
_vPosThe 3D position of the source.
_fGainThe volume of the source from 0 to 1 inclusive.
_fMaxDistanceMaximum distance at which the source can be heard.
Returns:
The ID of the created source is returned, which can be used to make modifications to the sound after loading. Play a sound effect at a given 2D position using a returned ID from a registered LSE_SFX_DATA structure. Buffer is loaded if not loaded already. Loop count and expiration dates are set according to the data registered with the system.
Parameters:
_ui32SfxIdThe ID of the registered sound effect containing the parameters for playing the sound.
_vPosThe 2D position of the source.
_fGainThe volume of the source from 0 to 1 inclusive.
Returns:
The ID of the created source is returned, which can be used to make modifications to the sound after loading. Register a sound-effect file. Returns the unique ID of the data which can be used to play the sound later. If registration fails (due to memory), 0 is returned.
Parameters:
_sdDataAn LSE_SFX_DATA structure containing the parameters for the sound effect.
Returns:
The ID of the registered sound effect or 0 upon failure. Unregister a sound effect by its unique ID.
Parameters:
_ui32SfxIdThe ID of the registered sound effect to unregister.
Returns:
Returns true if the given ID matches a registered sound effect. Register a streaming sound in a wave file. The file must be valid and contain valid PCM data in .wav format.
Parameters:
_pcFileThe UTF-8 path to the file.
Returns:
Returns true if the sound was created.
LSUINT32 LSE_CALL lss::RemAllUnreferencedBuffers ( )

Remove all unreferenced buffers. ** Must not be locked.

Returns:
Returns the total number of buffers that are referenced by static sources and were not removed.
LSVOID LSE_CALL lss::RemBuffer ( LSUINT32  _ui32Id)

Remove a buffer by ID. ** Must not be locked.

Parameters:
_ui32IdID of teh buffer to remove.
LSVOID LSE_CALL lss::RemSource ( LSUINT32  _ui32Id)

Remove a source by ID. ** Must not be locked.

Parameters:
_ui32IdID of the source to remove.
LSVOID LSE_CALL lss::ResetAllSounds ( ) [virtual]

Stop and remove all sources and buffers, and apply default parameters to the listener.

virtual LSVOID LSE_CALL lss::ResetDevice ( ) [protected, virtual]

Close the current device, if any. All buffers and sources are destroyed. But sound resources are not lost. Only their connections to the hardware are.

LSVOID LSE_CALL lss::Run ( )

Runs the sound manager loop. The loop is run on a new thread. This causes the sound manager to tick repeatedly, updating sources and the listener until requested to stop. During a single tick, sources and the listener may not be accessed. The loop rests for 16 milliseconds between ticks, making spins/waits unlikely.

LSVOID LSE_CALL lss::SetAllocator ( CAllocator *  _paAllocator) [virtual]

Set the allocator used by the sound system. This causes all resources to be reset and lost. This should be done only once at start-up, before any resources are created. _paAllocator may be NULL.

Parameters:
_paAllocatorThe allocator to be used by this class or NULL to use the global heap.

Set the allocator used by the sound system. This causes all resources to be reset and lost. This should be done only once at start-up, before any resources are created. _paAllocator may be NULL.

Parameters:
_paAllocatorThe allocator to be used by the sound engine.
virtual LSVOID LSE_CALL lss::SetBuffer ( const CSoundBuffer *  _psbBuffer) [virtual]

Set the buffer. Does not cause playing. NULL is valid.

Parameters:
_psbBufferThe possibly shared buffer to be used by this source.
virtual LSBOOL LSE_CALL lss::SetDevice ( const LSCHAR *  _pcDevice,
CString *  _pstrError = NULL 
) [virtual]

Set the current device. Causes all existing resources to be reloaded automatically. Only one device may be set at a time. If _pcDevice is NULL or an empty string, the default device is used.

Parameters:
_pcDeviceThe device to set.
_pstrErrorReturned error if any.
Returns:
Returns true if the device was set.
LSVOID LSE_CALL lss::SetListenerPos ( const CVector3 &  _svPos)

The most common function performed on the listener is to set its position. This function makes doing so easy. Does not need to be locked.

Parameters:
_svPosNew listener position.
LSVOID LSE_CALL lss::SetListenerPosAndVel ( const CVector3 &  _svPos,
const CVector3 &  _svVel 
)

This function allows setting both position and velocity at the same time on the listener. Does not need to be locked.

Parameters:
_svPosNew listener position.
_svVelNew listener velocity.
LSVOID LSE_CALL lss::SetListenerVel ( const CVector3 &  _svVel)

Setting the listener velocity is common. Does not need to be locked.

Parameters:
_svVelNew listener velocity.
LSVOID LSE_CALL lss::SetMasterVolume ( LSSREAL  _fVolume)

Set the master volume. Ths sets the gain on the listener internally. Does not need to be locked.

Parameters:
_fVolumeNew master volume.
virtual LSVOID LSE_CALL lss::ShutDown ( ) [protected, virtual]

Reset the whole sound engine. Releases all resources.

LSVOID LSE_CALL lss::SoftReset ( ) [virtual]

Perform a soft reset. This removes unreferenced data and stops sounds that are not soft-reset-safe.

LSUINT32 LSE_CALL lss::SoundIsStreaming ( const LSCHAR *  _pcName) const

Determine if the given sound is already streaming.

Parameters:
_pcNamename of the stream to check. This name must match one of the names provided in a call to one of the Register*ForStream() functions.
Returns:
Returns the ID of the sound if it is already playing. If the sound does not exist or exists but is not in the playing or paused states, 0 is returned.
virtual LSBOOL LSE_CALL lss::Static ( ) const [virtual]

Is this source static (non-streaming)?

Returns:
Returns true if the source is static, false if streaming.
LSVOID LSE_CALL lss::Stop ( ) [virtual]

Stop the sound. Sets the position back to 0 and waits for a play command.

Returns:
Returns true if a buffer has been assigned to this source.

Stops the sound thread. Does not return until the thread as been fully stopped and closed.

LSVOID LSE_CALL lss::StopAndDeleteAllStaticSources ( )

Stop and delete all static sources. ** Must not be locked.

LSVOID LSE_CALL lss::SynchronousUpdate ( LSUINTPTR  _uiptrUserPtr,
PfSoundEventHandler  _pfHandler 
)

Perform a synchronous update of all sound sources. This is always executed on the main game thread and is used for issuing synchronous game events such as the beginning/ending of sounds.

Parameters:
_uiptrUserPtrUser data passed during the update on the main thread.
_pfHandlerPointer to a function used to handle events synchronously.
virtual LSVOID LSE_CALL lss::Tick ( LSUINT64  _ui64TimeSinceLastUpdate) [virtual]

Update the source. This usually entails checking the dirty flag and updating the hardware accordingly. Time is given in microseconds.

Parameters:
_ui64TimeSinceLastUpdateMicroseconds by which to update.
LSVOID LSE_CALL lss::Tick ( )

Tick once. Updates time and all objects.

LSVOID LSE_CALL lss::UnLock ( ) const

Unlock its contents. Items cannot be added while locked.

virtual LSVOID LSE_CALL lss::UpdatePlayState ( ) [protected, virtual]

Update the play state.


Variable Documentation

Is our play state dirty?

The Ogg file.

CAllocator * lss::m_paAllocator

The allocator we use.

LSCHAR* lss::m_pcPath

The path to this wave file in UTF-8 format. This also serves as the name of the object.

The buffer to which we are attached.

File information.

LSUINT64 lss::m_ui64Pcms

Number of PCM's.

Length of the sound in microseconds.

 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator