3dcam-headers/include/sound.h

41 lines
1.9 KiB
C
Raw Normal View History

2021-08-10 18:44:19 +02:00
#pragma once
2021-11-28 19:59:05 +01:00
#include <psx.h>
#include <camera.h>
#include <math.h>
#include <macros.h>
2021-08-10 18:44:19 +02:00
// XA
// Sector offset for XA data 4: simple speed, 8: double speed
#define XA_CHANNELS 8
2021-08-17 16:44:42 +02:00
#define XA_CDSPEED (XA_CHANNELS >> VSYNC) * ONE
#define XA_RATE 380
// Number of XA samples ( != # of XA files )
#define XA_TRACKS 2
2021-08-26 19:55:00 +02:00
// SPU
#define MALLOC_MAX 48 // Max number of time we can call SpuMalloc
// VAG header struct (see fileformat47.pdf, p.209)
typedef struct VAGhdr { // All the values in this header must be big endian
char id[4]; // VAGp 4 bytes -> 1 char * 4
unsigned int version; // 4 bytes
unsigned int reserved; // 4 bytes
unsigned int dataSize; // (in bytes) 4 bytes
unsigned int samplingFrequency;// 4 bytes
char reserved2[12]; // 12 bytes -> 1 char * 12
char name[16]; // 16 bytes -> 1 char * 16
// Waveform data after that
} VAGhdr;
// VAG playback
2021-08-26 19:55:00 +02:00
void initSnd(SpuCommonAttr * spuSettings, char * spu_malloc_rec, u_int mallocMax);
u_long sendVAGtoSPU(unsigned int VAG_data_size, u_char *VAG_data);
void setVoiceAttr(SpuVoiceAttr * voiceAttributes, u_int pitch, long channel, u_long soundAddr );
u_long setSPUtransfer(SpuVoiceAttr * voiceAttributes, VAGsound * sound);
2021-09-01 18:37:00 +02:00
void setVAGvolume(SpuVoiceAttr * voiceAttributes, VAGsound * sound, int volumeL,int volumeR);
void setLvlVAG(LEVEL * level, SpuCommonAttr * spuSettings, SpuVoiceAttr * voiceAttributes, char spu_malloc_rec[]);
void playSFX(SpuVoiceAttr * voiceAttributes, VAGsound * sound, int volumeL, int volumeR );
2021-09-14 20:35:48 +02:00
void setSFXdist(LEVEL * level, CAMERA * camera, int camMode);
// XA playback
void XAsetup(void);
2021-08-16 16:20:36 +02:00
void getXAoffset(LEVEL * level);
void setXAsample(XAsound * sound, CdlFILTER * filter);
2021-09-01 18:37:00 +02:00
void setLvlXA(LEVEL * level, int sample);
void XAplayback(LEVEL * level, int sample, long dt);