mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
New CON command
setactorsoundpitch <actor#> <sound#> <pitchoffset> which can be used to change the pitch of a playing sound. The pitch offset has the same meaning as the definesound pitch range endpoints, i.e. the units are 1/100th of a seminote. Note that just like the random pitch offset, increasing the pitch makes the sound duration shorter (and vice versa). git-svn-id: https://svn.eduke32.com/eduke32@2104 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
59670ed45e
commit
e94243d7db
5 changed files with 46 additions and 0 deletions
|
@ -83,6 +83,7 @@ static struct { uint32_t keyw; uint32_t date; } g_keywdate[] =
|
||||||
{ CON_CALCHYPOTENUSE, 20100927 },
|
{ CON_CALCHYPOTENUSE, 20100927 },
|
||||||
{ CON_CLIPMOVENOSLIDE, 20101009 },
|
{ CON_CLIPMOVENOSLIDE, 20101009 },
|
||||||
{ CON_INCLUDEDEFAULT, 20110615 },
|
{ CON_INCLUDEDEFAULT, 20110615 },
|
||||||
|
{ CON_SETACTORSOUNDPITCH, 20111102 },
|
||||||
};
|
};
|
||||||
|
|
||||||
char g_szScriptFileName[BMAX_PATH] = "(none)"; // file we're currently compiling
|
char g_szScriptFileName[BMAX_PATH] = "(none)"; // file we're currently compiling
|
||||||
|
@ -562,6 +563,7 @@ const char *keyw[] =
|
||||||
"calchypotenuse", // 358
|
"calchypotenuse", // 358
|
||||||
"clipmovenoslide", // 359
|
"clipmovenoslide", // 359
|
||||||
"includedefault", // 360
|
"includedefault", // 360
|
||||||
|
"setactorsoundpitch", // 361
|
||||||
"<null>"
|
"<null>"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3477,6 +3479,10 @@ static int32_t C_ParseCommand(int32_t loop)
|
||||||
C_GetManyVars(2);
|
C_GetManyVars(2);
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
case CON_SETACTORSOUNDPITCH:
|
||||||
|
C_GetManyVars(3);
|
||||||
|
continue;
|
||||||
|
|
||||||
case CON_SECTOROFWALL:
|
case CON_SECTOROFWALL:
|
||||||
C_GetNextVarType(GAMEVAR_READONLY);
|
C_GetNextVarType(GAMEVAR_READONLY);
|
||||||
C_GetNextVar();
|
C_GetNextVar();
|
||||||
|
|
|
@ -936,6 +936,7 @@ enum ScriptKeywords_t
|
||||||
CON_CALCHYPOTENUSE, // 358
|
CON_CALCHYPOTENUSE, // 358
|
||||||
CON_CLIPMOVENOSLIDE, // 359
|
CON_CLIPMOVENOSLIDE, // 359
|
||||||
CON_INCLUDEDEFAULT, // 360
|
CON_INCLUDEDEFAULT, // 360
|
||||||
|
CON_SETACTORSOUNDPITCH, // 361
|
||||||
CON_END
|
CON_END
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1089,6 +1089,22 @@ skip_check:
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case CON_SETACTORSOUNDPITCH:
|
||||||
|
insptr++;
|
||||||
|
{
|
||||||
|
int32_t i = Gv_GetVarX(*insptr++), j = Gv_GetVarX(*insptr++), pitchoffset = Gv_GetVarX(*insptr++);
|
||||||
|
|
||||||
|
if ((j<0 || j>=MAXSOUNDS))
|
||||||
|
{
|
||||||
|
OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],j);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
S_ChangeSoundPitch(j,i,pitchoffset);
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
case CON_GLOBALSOUND:
|
case CON_GLOBALSOUND:
|
||||||
if (((unsigned)*(++insptr) >= MAXSOUNDS))
|
if (((unsigned)*(++insptr) >= MAXSOUNDS))
|
||||||
{
|
{
|
||||||
|
|
|
@ -663,6 +663,28 @@ void S_StopEnvSound(int32_t num, int32_t i)
|
||||||
while (j >= 0);
|
while (j >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void S_ChangeSoundPitch(int32_t num, int32_t i, int32_t pitchoffset)
|
||||||
|
{
|
||||||
|
int32_t j;
|
||||||
|
|
||||||
|
if ((unsigned)num > (unsigned)g_maxSoundPos || g_sounds[num].num <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (j=MAXSOUNDINSTANCES-1; j>=0; j--)
|
||||||
|
{
|
||||||
|
int32_t voice = g_sounds[num].SoundOwner[j].voice;
|
||||||
|
|
||||||
|
if ((i == -1 && voice > FX_Ok) || (i != -1 && g_sounds[num].SoundOwner[j].i == i))
|
||||||
|
{
|
||||||
|
if (i >= 0 && voice <= FX_Ok)
|
||||||
|
initprintf(OSD_ERROR "S_ChangeSoundPitch(): bad voice %d for sound ID %d index %d!\n", voice, num, j);
|
||||||
|
else if (voice > FX_Ok && FX_SoundActive(voice))
|
||||||
|
FX_SetPitch(voice, pitchoffset);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void S_Update(void)
|
void S_Update(void)
|
||||||
{
|
{
|
||||||
vec3_t *s, *c;
|
vec3_t *s, *c;
|
||||||
|
|
|
@ -89,5 +89,6 @@ void S_SoundStartup(void);
|
||||||
void S_StopEnvSound(int32_t num,int32_t i);
|
void S_StopEnvSound(int32_t num,int32_t i);
|
||||||
void S_StopMusic(void);
|
void S_StopMusic(void);
|
||||||
void S_Update(void);
|
void S_Update(void);
|
||||||
|
void S_ChangeSoundPitch(int32_t num, int32_t i, int32_t pitchoffset);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue