wscript: add videoservices

This commit is contained in:
nillerusr
2022-10-13 17:47:27 +03:00
parent bca0ae8c59
commit 2f15ebbfb8
20 changed files with 7 additions and 5 deletions

View File

@@ -10,8 +10,8 @@
#define SND_DEVICE_H
#pragma once
#include "snd_fixedint.h"
#include "snd_mix_buf.h"
#include "engine/audio/snd_fixedint.h"
#include "engine/audio/snd_mix_buf.h"
// sound engine rate defines
#define SOUND_DMA_SPEED 44100 // hardware playback rate

View File

@@ -0,0 +1,40 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef SND_FIXEDINT_H
#define SND_FIXEDINT_H
#if defined( _WIN32 )
#pragma once
#endif
// fixed point stuff for real-time resampling
#define FIX_BITS 28
#define FIX_SCALE (1 << FIX_BITS)
#define FIX_MASK ((1 << FIX_BITS)-1)
#define FIX_FLOAT(a) ((int)((a) * FIX_SCALE))
#define FIX(a) (((int)(a)) << FIX_BITS)
#define FIX_INTPART(a) (((int)(a)) >> FIX_BITS)
#define FIX_FRACTION(a,b) (FIX(a)/(b))
#define FIX_FRACPART(a) ((a) & FIX_MASK)
#define FIX_TODOUBLE(a) ((double)(a) / (double)FIX_SCALE)
typedef unsigned int fixedint;
#define FIX_BITS14 14
#define FIX_SCALE14 (1 << FIX_BITS14)
#define FIX_MASK14 ((1 << FIX_BITS14)-1)
#define FIX_FLOAT14(a) ((int)((a) * FIX_SCALE14))
#define FIX14(a) (((int)(a)) << FIX_BITS14)
#define FIX_INTPART14(a) (((int)(a)) >> FIX_BITS14)
#define FIX_FRACTION14(a,b) (FIX14(a)/(b))
#define FIX_FRACPART14(a) ((a) & FIX_MASK14)
#define FIX_14TODOUBLE(a) ((double)(a) / (double)FIX_SCALE14)
#define FIX_28TO14(a) ( (int)( ((unsigned int)(a)) >> (FIX_BITS - 14) ) )
#endif // SND_FIXEDINT_H

View File

@@ -0,0 +1,109 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef SND_MIX_BUF_H
#define SND_MIX_BUF_H
#include "utlvector.h"
#if defined( _WIN32 )
#pragma once
#endif
// OPTIMIZE: note that making this larger will not increase performance (12/27/03)
#define PAINTBUFFER_SIZE 1020 // 44k: was 512
#define PAINTBUFFER (g_curpaintbuffer)
#define REARPAINTBUFFER (g_currearpaintbuffer)
#define CENTERPAINTBUFFER (g_curcenterpaintbuffer)
enum SoundBufferType_t
{
SOUND_BUFFER_PAINT = 0,
SOUND_BUFFER_ROOM,
SOUND_BUFFER_FACING,
SOUND_BUFFER_FACINGAWAY,
SOUND_BUFFER_DRY,
SOUND_BUFFER_SPEAKER,
SOUND_BUFFER_BASETOTAL,
SOUND_BUFFER_SPECIAL_START = SOUND_BUFFER_BASETOTAL
};
// !!! if this is changed, it much be changed in native assembly too !!!
struct portable_samplepair_t
{
int left;
int right;
};
// sound mixing buffer
#define CPAINTFILTERMEM 3
#define CPAINTFILTERS 4 // maximum number of consecutive upsample passes per paintbuffer
struct paintbuffer_t
{
bool factive; // if true, mix to this paintbuffer using flags
bool fsurround; // if true, mix to front and rear paintbuffers using flags
bool fsurround_center; // if true, mix to front, rear and center paintbuffers using flags
int idsp_specialdsp;
int nPrevSpecialDSP;
int nSpecialDSP;
int flags; // SOUND_BUSS_ROOM, SOUND_BUSS_FACING, SOUND_BUSS_FACINGAWAY, SOUND_BUSS_SPEAKER, SOUND_BUSS_SPECIAL_DSP, SOUND_BUSS_DRY
portable_samplepair_t *pbuf; // front stereo mix buffer, for 2 or 4 channel mixing
portable_samplepair_t *pbufrear; // rear mix buffer, for 4 channel mixing
portable_samplepair_t *pbufcenter; // center mix buffer, for 5 channel mixing
int ifilter; // current filter memory buffer to use for upsampling pass
portable_samplepair_t fltmem[CPAINTFILTERS][CPAINTFILTERMEM]; // filter memory, for upsampling with linear or cubic interpolation
portable_samplepair_t fltmemrear[CPAINTFILTERS][CPAINTFILTERMEM]; // filter memory, for upsampling with linear or cubic interpolation
portable_samplepair_t fltmemcenter[CPAINTFILTERS][CPAINTFILTERMEM]; // filter memory, for upsampling with linear or cubic interpolation
};
extern "C"
{
extern portable_samplepair_t *g_paintbuffer;
// temp paintbuffer - not included in main list of paintbuffers
extern portable_samplepair_t *g_temppaintbuffer;
extern CUtlVector< paintbuffer_t > g_paintBuffers;
extern void MIX_SetCurrentPaintbuffer( int ipaintbuffer );
extern int MIX_GetCurrentPaintbufferIndex( void );
extern paintbuffer_t *MIX_GetCurrentPaintbufferPtr( void );
extern paintbuffer_t *MIX_GetPPaintFromIPaint( int ipaintbuffer );
extern void MIX_ClearAllPaintBuffers( int SampleCount, bool clearFilters );
extern bool MIX_InitAllPaintbuffers(void);
extern void MIX_FreeAllPaintbuffers(void);
extern portable_samplepair_t *g_curpaintbuffer;
extern portable_samplepair_t *g_currearpaintbuffer;
extern portable_samplepair_t *g_curcenterpaintbuffer;
};
// must be at least PAINTBUFFER_SIZE+1 for upsampling
#define PAINTBUFFER_MEM_SIZE (PAINTBUFFER_SIZE+4)
// size in samples of copy buffer used by pitch shifters in mixing
#if defined(_GAMECONSOLE)
#define TEMP_COPY_BUFFER_SIZE (PAINTBUFFER_MEM_SIZE * 2)
#else
// allow more memory for this on PC for developers to pitch-shift their way through dialog
#define TEMP_COPY_BUFFER_SIZE (PAINTBUFFER_MEM_SIZE * 4)
#endif
// hard clip input value to -32767 <= y <= 32767
#define CLIP(x) ((x) > 32767 ? 32767 : ((x) < -32767 ? -32767 : (x)))
#endif // SND_MIX_BUF_H