@@ -1181,32 +1181,22 @@ function getFreeVoice(_props)
1181
1181
return null ;
1182
1182
}
1183
1183
1184
- function Audio_GetSound ( soundid )
1185
- {
1186
- var pSound = null ;
1187
- if ( soundid >= 0 && soundid <= audio_sampledata . length )
1188
- {
1189
- pSound = audio_sampledata [ soundid ] ;
1190
- }
1191
- else
1192
- {
1193
- var bufferSoundId = soundid - BASE_BUFFER_SOUND_INDEX ;
1194
- if ( bufferSoundId >= 0 && bufferSoundId < g_bufferSoundCount )
1195
- {
1196
- pSound = buffer_sampledata [ bufferSoundId ] ;
1197
- }
1198
- else
1199
- {
1200
- var queueSoundId = soundid - BASE_QUEUE_SOUND_INDEX ;
1184
+ function Audio_GetSound ( soundid ) {
1185
+ if ( soundid >= 0 && soundid < audio_sampledata . length ) {
1186
+ return audio_sampledata [ soundid ] ;
1187
+ }
1201
1188
1202
- if ( queueSoundId >= 0 && queueSoundId < g_queueSoundCount )
1203
- {
1204
- pSound = queue_sampledata [ queueSoundId ] ;
1205
- }
1206
- }
1207
- }
1189
+ const bufferSoundId = soundid - BASE_BUFFER_SOUND_INDEX ;
1190
+ if ( bufferSoundId >= 0 && bufferSoundId < g_bufferSoundCount ) {
1191
+ return buffer_sampledata [ bufferSoundId ] ;
1192
+ }
1193
+
1194
+ const queueSoundId = soundid - BASE_QUEUE_SOUND_INDEX ;
1195
+ if ( queueSoundId >= 0 && queueSoundId < g_queueSoundCount ) {
1196
+ return queue_sampledata [ queueSoundId ] ;
1197
+ }
1208
1198
1209
- return pSound ;
1199
+ return null ;
1210
1200
}
1211
1201
1212
1202
function Audio_GetEmitterOrThrow ( _emitterIndex ) {
@@ -1509,8 +1499,9 @@ function audio_sound_get_gain(_index)
1509
1499
else {
1510
1500
const asset = Audio_GetSound ( _index ) ;
1511
1501
1512
- if ( asset !== undefined )
1502
+ if ( asset !== null ) {
1513
1503
return asset . gain . get ( ) ;
1504
+ }
1514
1505
}
1515
1506
1516
1507
return 0 ;
@@ -1643,8 +1634,7 @@ function audio_sound_get_track_position(_soundid)
1643
1634
{
1644
1635
const sound_asset = Audio_GetSound ( _soundid ) ;
1645
1636
1646
- if ( sound_asset != undefined )
1647
- {
1637
+ if ( sound_asset !== null ) {
1648
1638
return sound_asset . trackPos ;
1649
1639
}
1650
1640
}
@@ -1678,8 +1668,7 @@ function audio_sound_set_track_position(_soundid, _time)
1678
1668
{
1679
1669
const sampleData = Audio_GetSound ( _soundid ) ;
1680
1670
1681
- if ( sampleData != undefined )
1682
- {
1671
+ if ( sampleData !== null ) {
1683
1672
sampleData . trackPos = _time ;
1684
1673
}
1685
1674
}
0 commit comments