Skip to content

Commit 471a840

Browse files
committed
Fix soundlevel_t compile error on VS2013
1 parent 7f0aec4 commit 471a840

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

sp/src/public/soundflags.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ enum soundlevel_t
102102
#define MAX_SNDLVL_VALUE ((1<<MAX_SNDLVL_BITS)-1)
103103

104104

105+
#if !defined(LINUX)
106+
#define ATTN_TO_SNDLVL( a ) (soundlevel_t)(int)((a) ? (50 + 20 / ((float)a)) : 0 )
107+
#define SNDLVL_TO_ATTN( a ) ((a > 50) ? (20.0f / (float)(a - 50)) : 4.0 )
108+
#else
105109
inline soundlevel_t ATTN_TO_SNDLVL(float a)
106110
{
107111
soundlevel_t sndlvl = soundlevel_t::SNDLVL_NONE;
@@ -118,6 +122,7 @@ inline float SNDLVL_TO_ATTN(soundlevel_t s)
118122
{
119123
return (s > soundlevel_t::SNDLVL_50dB)? (20.0f / float(s - soundlevel_t::SNDLVL_50dB)) : 4.0f;
120124
}
125+
#endif
121126

122127
// This is a limit due to network encoding.
123128
// It encodes attenuation * 64 in 8 bits, so the maximum is (255 / 64)

0 commit comments

Comments
 (0)