diff --git a/engine/client/cl_cmds.c b/engine/client/cl_cmds.c index 1da66afa..fcc3f3cc 100644 --- a/engine/client/cl_cmds.c +++ b/engine/client/cl_cmds.c @@ -418,3 +418,32 @@ void SCR_Viewpos_f( void ) Con_Printf( "org ( %g %g %g )\n", refState.vieworg[0], refState.vieworg[1], refState.vieworg[2] ); Con_Printf( "ang ( %g %g %g )\n", refState.viewangles[0], refState.viewangles[1], refState.viewangles[2] ); } + +/* +============= +CL_WavePlayLen_f + +============= +*/ +void CL_WavePlayLen_f( void ) +{ + const char *name; + uint msecs; + + if( Cmd_Argc() != 2 ) + { + Con_Printf( "waveplaylen : returns approximate number of milliseconds a wave file will take to play.\n" ); + return; + } + + name = Cmd_Argv( 1 ); + msecs = Sound_GetApproxWavePlayLen( name ); + + if( msecs == 0 ) + { + Con_Printf( "Unable to read %s, file may be missing or incorrectly formatted.\n", name ); + return; + } + + Con_Printf( "Play time is approximately %dms\n", msecs ); +} diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index f6887ae7..a32c4e48 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -2879,6 +2879,7 @@ void CL_InitLocal( void ) Cmd_AddCommand ("internetservers", CL_InternetServers_f, "collect info about internet servers" ); Cmd_AddCommand ("cd", CL_PlayCDTrack_f, "Play cd-track (not real cd-player of course)" ); Cmd_AddCommand ("mp3", CL_PlayCDTrack_f, "Play mp3-track (based on virtual cd-player)" ); + Cmd_AddCommand ("waveplaylen", CL_WavePlayLen_f, "Get approximate length of wave file"); Cmd_AddCommand ("setinfo", CL_SetInfo_f, "examine or change the userinfo string (alias of userinfo)" ); Cmd_AddCommand ("userinfo", CL_SetInfo_f, "examine or change the userinfo string (alias of setinfo)" ); diff --git a/engine/client/client.h b/engine/client/client.h index c39e2388..f2d97d88 100644 --- a/engine/client/client.h +++ b/engine/client/client.h @@ -717,6 +717,7 @@ void CL_SaveShot_f( void ); void CL_LevelShot_f( void ); void CL_SetSky_f( void ); void SCR_Viewpos_f( void ); +void CL_WavePlayLen_f( void ); // // cl_custom.c