Commit Description:
Optimize PreserveCounts and only recalculate when needed....
Commit Description:
Optimize PreserveCounts and only recalculate when needed. Previously would recalculate preservecounts every Update call (~1 per frame), which isn't necessary when there's no tick. Might be some room to tweak, like doing these updates only when preserves change. Some measurements: This takes about 30ms versus the .25 ms with no preserve (then like .0002ms). When the map is filled up with preserve, about 35ms and 9ms. With a handful of cells, it's more like 0.8ms (before JIT optimizes most of it away).
File last commit:
Show/Diff file:
Action:
FNA/lib/FAudio/utils/wavcommon/wavs.cpp
42 lines | 927 B | text/x-c | CppLexer
#define DR_WAV_IMPLEMENTATION
#include "wavs.h"
#ifndef RESOURCE_PATH
#ifdef _MSC_VER
#define RESOURCE_PATH "../../utils/wavcommon/resources"
#else
#define RESOURCE_PATH "utils/wavcommon/resources"
#endif
#endif
const char *audio_sample_filenames[] =
{
RESOURCE_PATH"/snaredrum_forte.wav",
RESOURCE_PATH"/snaredrum_fortissimo.wav",
RESOURCE_PATH"/snaredrum_mezzoforte.wav",
};
const char *audio_stereo_filenames[] =
{
RESOURCE_PATH"/snaredrum_forte_stereo.wav",
RESOURCE_PATH"/snaredrum_fortissimo_stereo.wav",
RESOURCE_PATH"/snaredrum_mezzoforte_stereo.wav",
};
float* WAVS_Open(
AudioSampleWave sample,
bool stereo,
unsigned int *wav_channels,
unsigned int *wav_samplerate,
drwav_uint64 *wav_sample_count
) {
return drwav_open_file_and_read_pcm_frames_f32(
(!stereo) ?
audio_sample_filenames[sample] :
audio_stereo_filenames[sample],
wav_channels,
wav_samplerate,
wav_sample_count,
NULL
);
}