mirror of
https://github.com/love2d/megasource.git
synced 2026-08-19 04:05:09 +02:00
update OpenAL-Soft to 1.24.3.
This commit is contained in:
@@ -185,9 +185,9 @@ int main(int argc, char *argv[])
|
||||
const char *appname = argv[0];
|
||||
ALuint source, buffer;
|
||||
ALint last_pos;
|
||||
ALint seconds = 4;
|
||||
ALuint seconds = 4;
|
||||
ALint srate = -1;
|
||||
ALint tone_freq = 1000;
|
||||
ALuint tone_freq = 1000;
|
||||
ALCint dev_rate;
|
||||
ALenum state;
|
||||
ALfloat gain = 1.0f;
|
||||
@@ -229,9 +229,10 @@ int main(int argc, char *argv[])
|
||||
|
||||
if(i+1 < argc && strcmp(argv[i], "-t") == 0)
|
||||
{
|
||||
char *endptr = NULL;
|
||||
i++;
|
||||
seconds = atoi(argv[i]);
|
||||
if(seconds <= 0)
|
||||
seconds = (ALuint)strtoul(argv[i], &endptr, 0);
|
||||
if(!endptr || *endptr != '\0' || seconds <= 0)
|
||||
seconds = 4;
|
||||
}
|
||||
else if(i+1 < argc && (strcmp(argv[i], "--waveform") == 0 || strcmp(argv[i], "-w") == 0))
|
||||
@@ -254,9 +255,10 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
else if(i+1 < argc && (strcmp(argv[i], "--freq") == 0 || strcmp(argv[i], "-f") == 0))
|
||||
{
|
||||
char *endptr = NULL;
|
||||
i++;
|
||||
tone_freq = atoi(argv[i]);
|
||||
if(tone_freq < 1)
|
||||
tone_freq = (ALuint)strtoul(argv[i], &endptr, 0);
|
||||
if(!endptr || *endptr != '\0' || tone_freq < 1)
|
||||
{
|
||||
fprintf(stderr, "Invalid tone frequency: %s (min: 1hz)\n", argv[i]);
|
||||
tone_freq = 1;
|
||||
@@ -264,9 +266,10 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
else if(i+1 < argc && (strcmp(argv[i], "--gain") == 0 || strcmp(argv[i], "-g") == 0))
|
||||
{
|
||||
char *endptr = NULL;
|
||||
i++;
|
||||
gain = (ALfloat)atof(argv[i]);
|
||||
if(gain < 0.0f || gain > 1.0f)
|
||||
gain = strtof(argv[i], &endptr);
|
||||
if(!endptr || *endptr != '\0' || gain < 0.0f || gain > 1.0f)
|
||||
{
|
||||
fprintf(stderr, "Invalid gain: %s (min: 0.0, max 1.0)\n", argv[i]);
|
||||
gain = 1.0f;
|
||||
@@ -274,9 +277,10 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
else if(i+1 < argc && (strcmp(argv[i], "--srate") == 0 || strcmp(argv[i], "-s") == 0))
|
||||
{
|
||||
char *endptr = NULL;
|
||||
i++;
|
||||
srate = atoi(argv[i]);
|
||||
if(srate < 40)
|
||||
srate = (ALint)strtol(argv[i], &endptr, 0);
|
||||
if(!endptr || *endptr != '\0' || srate < 40)
|
||||
{
|
||||
fprintf(stderr, "Invalid sample rate: %s (min: 40hz)\n", argv[i]);
|
||||
srate = 40;
|
||||
@@ -293,15 +297,15 @@ int main(int argc, char *argv[])
|
||||
srate = dev_rate;
|
||||
|
||||
/* Load the sound into a buffer. */
|
||||
buffer = CreateWave(wavetype, (ALuint)seconds, (ALuint)tone_freq, (ALuint)srate, gain);
|
||||
buffer = CreateWave(wavetype, seconds, tone_freq, (ALuint)srate, gain);
|
||||
if(!buffer)
|
||||
{
|
||||
CloseAL();
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf("Playing %dhz %s-wave tone with %dhz sample rate and %dhz output, for %d second%s...\n",
|
||||
tone_freq, GetWaveTypeName(wavetype), srate, dev_rate, seconds, (seconds!=1)?"s":"");
|
||||
printf("Playing %uhz %s-wave tone with %dhz sample rate and %dhz output, for %u second%s...\n",
|
||||
tone_freq, GetWaveTypeName(wavetype), srate, dev_rate, seconds, (seconds!=1)?"s":"");
|
||||
fflush(stdout);
|
||||
|
||||
/* Create the source to play the sound with. */
|
||||
@@ -322,7 +326,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
if(pos > last_pos)
|
||||
{
|
||||
printf("%d...\n", seconds - pos);
|
||||
printf("%u...\n", seconds - (ALuint)pos);
|
||||
fflush(stdout);
|
||||
}
|
||||
last_pos = pos;
|
||||
|
||||
Reference in New Issue
Block a user