Skip to content

Commit 0e65d18

Browse files
committed
Lock sound lumps before caching them
Otherwise lump_data will be NULL when calling W_GetModifiableLumpData().
1 parent 10f4149 commit 0e65d18

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

prboom2/src/SDL/i_sound.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ INLINE static dboolean IsDMXSound(const byte *data, int len)
272272
return len > DMXHDRSIZE && data[0] == 0x03 && data[1] == 0x00;
273273
}
274274

275-
static void CacheSounds(void)
275+
void I_CacheSounds(void)
276276
{
277277
int id;
278278
for (id = 1; id < num_sfx; id++)
@@ -825,10 +825,6 @@ void I_InitSound(void)
825825
if (!nomusicparm)
826826
I_InitMusic();
827827

828-
lprintf(LO_DEBUG, " Precaching all sound effects... ");
829-
CacheSounds();
830-
lprintf(LO_DEBUG, "done\n");
831-
832828
lprintf(LO_DEBUG, "I_InitSound: sound module ready\n");
833829
SDL_PauseAudio(0);
834830
}

prboom2/src/i_sound.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ void I_ShutdownSound(void);
5656
// SFX I/O
5757
//
5858

59+
void I_CacheSounds(void);
60+
5961
// Initialize channels?
6062
void I_SetChannels(void);
6163

prboom2/src/s_sound.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,10 @@ void S_Init(void)
203203

204204
dsda_CacheSoundLumps();
205205

206+
lprintf(LO_DEBUG, " Precaching all sound effects... ");
207+
I_CacheSounds();
208+
lprintf(LO_DEBUG, "done\n");
209+
206210
// {
207211
// int i;
208212
// const int snd_curve_length = 1200;

0 commit comments

Comments
 (0)