#include <ASound.h>
Definition at line 12 of file ASound.h.
◆ ASound()
Definition at line 12 of file ASound.cpp.
13 : m_iFlags( 0 ), m_iId( 0 ), m_uiCategoryIndex( 0 ), m_ui8Priority( 255 ), m_fMinDist( 1.0f ), m_vecSamples(
AMemory::GetAllocator(
AMemory::POOL_Sound ), 1, 1 ), m_vecTracks(
AMemory::GetAllocator(
AMemory::POOL_Sound ), 1, 1 )
14{
15}
static Toshi::T2Allocator * GetAllocator(POOL a_ePool)
◆ GetFirstWaveForTrack()
TINT ASound::GetFirstWaveForTrack |
( |
TINT | a_iTrack | ) |
const |
Definition at line 17 of file ASound.cpp.
18{
19 TINT iFirstWaveIndex = 0;
20 for (
TINT iTrack = 0; iTrack < a_iTrack; iTrack++ )
21 iFirstWaveIndex += m_vecTracks[ iTrack ];
22
23 return iFirstWaveIndex;
24}
◆ GetRandomSample()
TINT ASound::GetRandomSample |
( |
TINT | a_iWaveIndexMin, |
|
|
TINT | a_iWaveIndexMax ) |
Definition at line 26 of file ASound.cpp.
27{
28 return a_iWaveIndexMin + ARandom::GetSingleton()->m_oRandom.GetInt( a_iWaveIndexMax - a_iWaveIndexMin );
29}
◆ GetRandomSampleWeighted()
TINT ASound::GetRandomSampleWeighted |
( |
TINT | a_iTrackIndex, |
|
|
TINT | a_iWaveIndexMin, |
|
|
TINT | a_iWaveIndexMax ) |
Definition at line 31 of file ASound.cpp.
32{
34 TASSERT( a_iWaveIndexMax - a_iWaveIndexMin > 0 );
35
36 TINT iNumWaves = a_iWaveIndexMax - a_iWaveIndexMin;
37 TINT iTrackNumWaves = m_vecTracks[ a_iTrackIndex ];
39
40 TINT iTotalWeight = 0;
41 for (
TINT i = 0; i < a_iWaveIndexMax - a_iWaveIndexMin; i++ )
42 {
43 pWeights[ i ] = m_vecSamples[ i + a_iWaveIndexMin ].iWeight;
44 iTotalWeight += pWeights[ i ];
45 }
46
48 for (
TINT i = 0, j = 0; i < a_iWaveIndexMax - a_iWaveIndexMin; i++ )
49 {
50
51 for (
TINT k = 0; k < pWeights[ i ]; k++ )
52 {
54 pWeightedSamples[ j++ ] = a_iWaveIndexMin + i;
55 }
56 }
57
58 TINT iSelectedSample = ARandom::GetSingleton()->m_oRandom.GetInt( iTotalWeight );
59
60 delete[] pWeights;
61 delete[] pWeightedSamples;
62
63 return iSelectedSample;
64}
static Toshi::TMemory::MemBlock * GetMemBlock(POOL a_ePool)
◆ GetSamples()
Toshi::T2DynamicVector< Sample > & ASound::GetSamples |
( |
| ) |
|
|
inline |
Definition at line 42 of file ASound.h.
42{ return m_vecSamples; }
◆ ASoundManager
The documentation for this class was generated from the following files:
- D:/_dev/OpenBarnyard/Source/OpenBarnyard/Source/Sound/ASound.h
- D:/_dev/OpenBarnyard/Source/OpenBarnyard/Source/Sound/ASound.cpp