summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/i_sdlsound.c9
-rw-r--r--src/z_native.c5
-rw-r--r--src/z_zone.c5
-rw-r--r--src/z_zone.h2
4 files changed, 16 insertions, 5 deletions
diff --git a/src/i_sdlsound.c b/src/i_sdlsound.c
index cdb771e9..bb8229e4 100644
--- a/src/i_sdlsound.c
+++ b/src/i_sdlsound.c
@@ -63,8 +63,6 @@ static int mixer_channels;
int use_libsamplerate = 0;
-extern int mb_used;
-
// When a sound stops, check if it is still playing. If it is not,
// we can mark the sound data as CACHE to be freed back for other
// means.
@@ -364,17 +362,20 @@ static void I_PrecacheSounds_SRC(void)
uint32_t resampled_sound_length[NUMSFX];
float norm_factor;
float max_amp = 0;
+ unsigned int zone_size;
assert(use_libsamplerate);
- if (mb_used < 32)
+ zone_size = Z_ZoneSize();
+
+ if (zone_size < 32 * 1024 * 1024)
{
fprintf(stderr,
"WARNING: low memory. Heap size is only %d MiB.\n"
"WARNING: use_libsamplerate needs more heap!\n"
"WARNING: put -mb 64 on the command line to avoid "
"\"Error: Z_Malloc: failed on allocation of X bytes\" !\n",
- mb_used);
+ zone_size / (1024 * 1024));
}
printf("I_PrecacheSounds_SRC: Precaching all sound effects..");
diff --git a/src/z_native.c b/src/z_native.c
index 199c9426..37bdc02a 100644
--- a/src/z_native.c
+++ b/src/z_native.c
@@ -483,3 +483,8 @@ int Z_FreeMemory(void)
return -1;
}
+unsigned int Z_ZoneSize(void)
+{
+ return 0;
+}
+
diff --git a/src/z_zone.c b/src/z_zone.c
index f0b8ad53..975f41e5 100644
--- a/src/z_zone.c
+++ b/src/z_zone.c
@@ -473,3 +473,8 @@ int Z_FreeMemory (void)
return free;
}
+unsigned int Z_ZoneSize(void)
+{
+ return mainzone->size;
+}
+
diff --git a/src/z_zone.h b/src/z_zone.h
index 44eb365b..a00630cf 100644
--- a/src/z_zone.h
+++ b/src/z_zone.h
@@ -67,7 +67,7 @@ void Z_FileDumpHeap (FILE *f);
void Z_CheckHeap (void);
void Z_ChangeTag2 (void *ptr, int tag, char *file, int line);
int Z_FreeMemory (void);
-
+unsigned int Z_ZoneSize(void);
//
// This is used to get the local FILE:LINE info from CPP