currently passing in sfx as a param in case I want to do something with it later.
| 5041 | // currently passing in sfx as a param in case I want to do something with it later. |
| 5042 | // |
| 5043 | byte *SND_malloc(int iSize, sfx_t *sfx) |
| 5044 | { |
| 5045 | byte *pData = (byte *) Z_Malloc(iSize, TAG_SND_RAWDATA, qfalse); // don't bother asking for zeroed mem |
| 5046 | |
| 5047 | // if "s_soundpoolmegs" is < 0, then the -ve of the value is the maximum amount of sounds we're allowed to have loaded... |
| 5048 | // |
| 5049 | if (s_soundpoolmegs && s_soundpoolmegs->integer < 0) |
| 5050 | { |
| 5051 | while ( (Z_MemSize(TAG_SND_RAWDATA) + Z_MemSize(TAG_SND_MP3STREAMHDR)) > ((-s_soundpoolmegs->integer) * 1024 * 1024)) |
| 5052 | { |
| 5053 | int iBytesFreed = SND_FreeOldestSound(sfx); |
| 5054 | if (iBytesFreed == 0) |
| 5055 | break; // sanity |
| 5056 | } |
| 5057 | } |
| 5058 | |
| 5059 | return pData; |
| 5060 | } |
| 5061 | |
| 5062 | |
| 5063 | // called once-only in EXE lifetime... |
no test coverage detected