Fix MHR limits

This commit is contained in:
Chris Robinson
2019-12-11 01:20:00 -08:00
parent 4867f93a34
commit 7d0c01050a
2 changed files with 9 additions and 17 deletions
+6 -10
View File
@@ -73,7 +73,6 @@ struct LoadedHrtf {
* the makemhr utility.
*/
#define MIN_IR_SIZE (8)
#define MAX_IR_SIZE (512)
#define MOD_IR_SIZE (2)
#define MIN_FD_COUNT (1)
@@ -622,10 +621,9 @@ std::unique_ptr<HrtfStore> LoadHrtf00(std::istream &data, const char *filename)
}
ALboolean failed{AL_FALSE};
if(irSize < MIN_IR_SIZE || irSize > MAX_IR_SIZE || (irSize%MOD_IR_SIZE))
if(irSize < MIN_IR_SIZE || irSize > HRIR_LENGTH)
{
ERR("Unsupported HRIR size: irSize=%d (%d to %d by %d)\n",
irSize, MIN_IR_SIZE, MAX_IR_SIZE, MOD_IR_SIZE);
ERR("Unsupported HRIR size, irSize=%d (%d to %d)\n", irSize, MIN_IR_SIZE, HRIR_LENGTH);
failed = AL_TRUE;
}
if(evCount < MIN_EV_COUNT || evCount > MAX_EV_COUNT)
@@ -739,10 +737,9 @@ std::unique_ptr<HrtfStore> LoadHrtf01(std::istream &data, const char *filename)
}
ALboolean failed{AL_FALSE};
if(irSize < MIN_IR_SIZE || irSize > MAX_IR_SIZE || (irSize%MOD_IR_SIZE))
if(irSize < MIN_IR_SIZE || irSize > HRIR_LENGTH)
{
ERR("Unsupported HRIR size: irSize=%d (%d to %d by %d)\n",
irSize, MIN_IR_SIZE, MAX_IR_SIZE, MOD_IR_SIZE);
ERR("Unsupported HRIR size, irSize=%d (%d to %d)\n", irSize, MIN_IR_SIZE, HRIR_LENGTH);
failed = AL_TRUE;
}
if(evCount < MIN_EV_COUNT || evCount > MAX_EV_COUNT)
@@ -856,10 +853,9 @@ std::unique_ptr<HrtfStore> LoadHrtf02(std::istream &data, const char *filename)
failed = AL_TRUE;
}
if(irSize < MIN_IR_SIZE || irSize > MAX_IR_SIZE || (irSize%MOD_IR_SIZE))
if(irSize < MIN_IR_SIZE || irSize > HRIR_LENGTH)
{
ERR("Unsupported HRIR size: irSize=%d (%d to %d by %d)\n",
irSize, MIN_IR_SIZE, MAX_IR_SIZE, MOD_IR_SIZE);
ERR("Unsupported HRIR size, irSize=%d (%d to %d)\n", irSize, MIN_IR_SIZE, HRIR_LENGTH);
failed = AL_TRUE;
}
if(fdCount < 1 || fdCount > MAX_FD_COUNT)
+3 -7
View File
@@ -128,16 +128,12 @@ enum HeadModelT {
// The limits to the truncation window size on the command line.
#define MIN_TRUNCSIZE (16)
#define MAX_TRUNCSIZE (512)
#define MAX_TRUNCSIZE (128)
// The limits to the custom head radius on the command line.
#define MIN_CUSTOM_RADIUS (0.05)
#define MAX_CUSTOM_RADIUS (0.15)
// The truncation window size must be a multiple of the below value to allow
// for vectorized convolution.
#define MOD_TRUNCSIZE (8)
// The defaults for the command line options.
#define DEFAULT_FFTSIZE (65536)
#define DEFAULT_EQUALIZE (1)
@@ -1510,9 +1506,9 @@ int main(int argc, char *argv[])
case 'w':
truncSize = static_cast<uint>(strtoul(optarg, &end, 10));
if(end[0] != '\0' || truncSize < MIN_TRUNCSIZE || truncSize > MAX_TRUNCSIZE || (truncSize%MOD_TRUNCSIZE))
if(end[0] != '\0' || truncSize < MIN_TRUNCSIZE || truncSize > MAX_TRUNCSIZE)
{
fprintf(stderr, "\nError: Got unexpected value \"%s\" for option -%c, expected multiple of %u between %u to %u.\n", optarg, opt, MOD_TRUNCSIZE, MIN_TRUNCSIZE, MAX_TRUNCSIZE);
fprintf(stderr, "\nError: Got unexpected value \"%s\" for option -%c, expected between %u to %u.\n", optarg, opt, MIN_TRUNCSIZE, MAX_TRUNCSIZE);
exit(EXIT_FAILURE);
}
break;