summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/sound/spu.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/emu/sound/spu.c')
-rw-r--r--src/emu/sound/spu.c156
1 files changed, 78 insertions, 78 deletions
diff --git a/src/emu/sound/spu.c b/src/emu/sound/spu.c
index b7248a5f03d..dca55ab6750 100644
--- a/src/emu/sound/spu.c
+++ b/src/emu/sound/spu.c
@@ -164,14 +164,14 @@ static const int filter_coef[5][2]=
//
#ifdef debug_spu_registers
- #define _voice_registers(_voice) \
- "voice"#_voice".voll", \
- "voice"#_voice".volr", \
- "voice"#_voice".pitch", \
- "voice"#_voice".addr", \
- "voice"#_voice".adsl", \
- "voice"#_voice".srrr", \
- "voice"#_voice".curvol", \
+ #define _voice_registers(_voice) \
+ "voice"#_voice".voll", \
+ "voice"#_voice".volr", \
+ "voice"#_voice".pitch", \
+ "voice"#_voice".addr", \
+ "voice"#_voice".adsl", \
+ "voice"#_voice".srrr", \
+ "voice"#_voice".curvol", \
"voice"#_voice".repaddr"
#define _voice_mask_register(_name) \
@@ -284,22 +284,22 @@ struct spu_device::sample_cache
{
public:
unsigned int start,
- end,
- invalid_start,
- invalid_end,
- loopaddr,
- last_update_end;
+ end,
+ invalid_start,
+ invalid_end,
+ loopaddr,
+ last_update_end;
signed short *data,*loop,*dend;
adpcm_decoder decoder, update_decoder;
mutable int ref_count;
bool valid,
- is_loop;
+ is_loop;
sample_loop_cache *loop_cache;
static unsigned int cache_size;
sample_cache()
- : invalid_start(0xffffffff),
+ : invalid_start(0xffffffff),
invalid_end(0),
last_update_end(0xffffffff),
data(NULL),
@@ -345,13 +345,13 @@ struct spu_device::sample_loop_cache
{
public:
unsigned int loopend,
- loopstart,
- len;
+ loopstart,
+ len;
signed short data[num_loop_cache_samples];
sample_loop_cache *next;
sample_loop_cache()
- : next(NULL)
+ : next(NULL)
{
sample_cache::cache_size+=num_loop_cache_samples<<1;
}
@@ -429,7 +429,7 @@ struct spu_device::voiceinfo
cache_pointer play,loop;
sample_loop_cache *loop_cache;
unsigned int dptr,
- lcptr;
+ lcptr;
int env_state;
float env_ar,
@@ -447,13 +447,13 @@ struct spu_device::voiceinfo
//<<
unsigned int pitch,
- samplestoend,
- samplestoirq,
- envsamples;
+ samplestoend,
+ samplestoirq,
+ envsamples;
bool hitirq,
- inloopcache,
- forceloop,
- _pad;
+ inloopcache,
+ forceloop,
+ _pad;
INT64 keyontime;
};
@@ -467,25 +467,25 @@ class stream_buffer
{
public:
unsigned int sector,
- offset;
+ offset;
stream_marker *next,
*prev;
};
unsigned char *buffer;
unsigned int head,
- tail,
- in,
- sector_size,
- num_sectors,
- buffer_size;
+ tail,
+ in,
+ sector_size,
+ num_sectors,
+ buffer_size;
stream_marker *marker_head,
*marker_tail;
public:
stream_buffer(const unsigned int _sector_size,
const unsigned int _num_sectors)
- : head(0),
+ : head(0),
tail(0),
in(0),
sector_size(_sector_size),
@@ -866,7 +866,7 @@ bool spu_device::cache_pointer::update(spu_device *spu)
// old cache block
unsigned int off=ptr-cache->data,
- addr=cache->start;
+ addr=cache->start;
// Release cache block and get updated one
@@ -935,14 +935,14 @@ signed short *adpcm_decoder::decode_packet(adpcm_packet *ap, signed short *dp)
static int shift_register15(int &shift)
{
- int bit0, bit1, bit14;
+ int bit0, bit1, bit14;
- bit0 = shift & 1;
- bit1 = (shift & 2) >> 1;
- bit14 = (bit0 ^ bit1) ^ 1;
- shift >>= 1;
- shift |= (bit14 << 14);
- return bit0;
+ bit0 = shift & 1;
+ bit1 = (shift & 2) >> 1;
+ bit14 = (bit0 ^ bit1) ^ 1;
+ shift >>= 1;
+ shift |= (bit14 << 14);
+ return bit0;
}
//
@@ -1482,7 +1482,7 @@ unsigned int spu_device::get_irq_distance(const voiceinfo *vi)
// IRQ address is inside this voices loop cache, return distance
return (vi->play.cache->dend-vi->play.ptr)+
- (irq_ptr-vi->loop.ptr);
+ (irq_ptr-vi->loop.ptr);
}
}
@@ -1508,7 +1508,7 @@ void spu_device::update_voice_events(voiceinfo *vi)
assert(vi->lcptr<vi->loop_cache->len);
vi->samplestoend=min(vi->samplestoend,
- (unsigned int)((((INT64)(vi->loop_cache->len-vi->lcptr)<<12)-vi->dptr)+(vi->pitch-1))/vi->pitch);
+ (unsigned int)((((INT64)(vi->loop_cache->len-vi->lcptr)<<12)-vi->dptr)+(vi->pitch-1))/vi->pitch);
}
// Calculate time until next IRQ in output samples
@@ -1700,10 +1700,10 @@ bool spu_device::process_voice(const unsigned int v,
{
bool ret=true;
unsigned int voice_mask=1<<v,
- num=sz,
- off=0;
+ num=sz,
+ off=0;
bool noise=((spureg.noise&voice_mask)!=0),
- fm=((spureg.fm&voice_mask)!=0);
+ fm=((spureg.fm&voice_mask)!=0);
voiceinfo *vi=&voice[v];
// Early exit if we don't have a sample cache block
@@ -1721,8 +1721,8 @@ bool spu_device::process_voice(const unsigned int v,
// Play up to end of sample, envelope event, or IRQ, whichever comes first
unsigned int ntoplay=fm?1:num,
- nextevent=min(vi->samplestoend,
- min(vi->samplestoirq,vi->envsamples));
+ nextevent=min(vi->samplestoend,
+ min(vi->samplestoirq,vi->envsamples));
ntoplay=min(ntoplay,nextevent);
if (ntoplay)
@@ -1743,7 +1743,7 @@ bool spu_device::process_voice(const unsigned int v,
}
signed short *dp=(signed short *)ptr,
- *outxp=(signed short *)outxptr;
+ *outxp=(signed short *)outxptr;
dp+=off<<1;
if (outxp) outxp+=off<<1;
@@ -1762,8 +1762,8 @@ bool spu_device::process_voice(const unsigned int v,
bool hitend=fm?(vi->play.ptr>=vi->play.cache->dend)
:(vi->samplestoend==0),
- hitirq=(vi->samplestoirq==0),
- hitenv=(vi->envsamples==0);
+ hitirq=(vi->samplestoirq==0),
+ hitenv=(vi->envsamples==0);
// Update loop cache pointer if we are playing a loop cache
@@ -1898,10 +1898,10 @@ bool spu_device::process_voice(const unsigned int v,
//
void spu_device::generate_voice(const unsigned int v,
- void *ptr,
- void *noiseptr,
- void *outxptr,
- const unsigned int sz)
+ void *ptr,
+ void *noiseptr,
+ void *outxptr,
+ const unsigned int sz)
{
voiceinfo *vi=&voice[v];
signed short *fp,*sp;
@@ -1927,9 +1927,9 @@ void spu_device::generate_voice(const unsigned int v,
// Calculate fixed point envelope levels/deltas premultiplied by channel volume
- int vol_l=outxptr?0x3fff:vi->vol[0],
+ int vol_l=outxptr?0x3fff:vi->vol[0],
vol_r=outxptr?0x3fff:vi->vol[1],
- env_l=(int)(vi->env_level*2.0f*vol_l),
+ env_l=(int)(vi->env_level*2.0f*vol_l),
env_r=(int)(vi->env_level*2.0f*vol_r),
envdelta_l=(int)(vi->env_delta*2.0f*vol_l),
envdelta_r=(int)(vi->env_delta*2.0f*vol_r);
@@ -2262,7 +2262,7 @@ bool spu_device::update_envelope(const int v)
case 4: // release
voice[v].env_level=mindb(1.0f,maxdb(0.0f,voice[v].env_level));
voice[v].env_delta=voice[v].env_rr;
- if (voice[v].env_rr == -0.0f) // 0.0 release means infinite time
+ if (voice[v].env_rr == -0.0f) // 0.0 release means infinite time
{
voice[v].envsamples=spu_infinity;
}
@@ -2406,9 +2406,9 @@ void spu_device::generate_xa(void *ptr, const unsigned int sz)
int n=sz>>2;
signed short *sp=(signed short *)xa_buffer->get_tail_ptr(),
- *dp=(signed short *)ptr;
+ *dp=(signed short *)ptr;
unsigned int noff=(1<<xa_channels),
- oldtail=xa_buffer->get_tail_offset();
+ oldtail=xa_buffer->get_tail_offset();
assert((xa_channels==1) || (xa_channels==2));
@@ -2433,7 +2433,7 @@ void spu_device::generate_xa(void *ptr, const unsigned int sz)
if (1) //settings.sound_interpolate)
{
signed short *nsp=(signed short *)xa_buffer->get_tail_ptr(noff);
- int vdl=nsp[0]-vl,
+ int vdl=nsp[0]-vl,
vdr=nsp[xa_channels-1]-vr;
vl+=(vdl*(int)xa_cnt)>>12;
@@ -2499,7 +2499,7 @@ void spu_device::generate_cdda(void *ptr, const unsigned int sz)
if (cdda_buffer->get_bytes_in())
{
unsigned int cdda_spf=(44100*4)/60.0,
- freq=(unsigned int)((cdda_freq*60.0)/60.0);
+ freq=(unsigned int)((cdda_freq*60.0)/60.0);
if ((! cdda_playing) && (cdda_buffer->get_bytes_in()<(cdda_spf<<3)))
return;
@@ -2508,7 +2508,7 @@ void spu_device::generate_cdda(void *ptr, const unsigned int sz)
int n=sz>>2;
signed short *sp=(signed short *)cdda_buffer->get_tail_ptr(),
- *dp=(signed short *)ptr;
+ *dp=(signed short *)ptr;
unsigned int oldtail=cdda_buffer->get_tail_offset();
int voll=spureg.cdvol_l,
@@ -2614,11 +2614,11 @@ void spu_device::generate(void *ptr, const unsigned int sz)
memcpy(dp,output_buf[0]+output_head,n);
rev->process((signed short *)dp,
- (signed short *)(output_buf[1]+output_head),
- spu_reverb_cfg,
- (signed short)spureg.rvol_l,
- (signed short)spureg.rvol_r,
- n);
+ (signed short *)(output_buf[1]+output_head),
+ spu_reverb_cfg,
+ (signed short)spureg.rvol_l,
+ (signed short)spureg.rvol_r,
+ n);
output_size-=n;
output_head+=n;
@@ -2744,9 +2744,9 @@ void spu_device::process_until(const unsigned int tsample)
{
unsigned int tleft=process_samples;
bool isfmin=((i<23) && (spureg.fm&(1<<(i+1)))),
- isfm=(spureg.fm&(1<<i))!=0,
- isnoise=(spureg.noise&(1<<i))!=0,
- isreverb=(spureg.reverb&(1<<i))!=0;
+ isfm=(spureg.fm&(1<<i))!=0,
+ isnoise=(spureg.noise&(1<<i))!=0,
+ isreverb=(spureg.reverb&(1<<i))!=0;
// This channel is an FM input for the next channel - clear the
// FM input buffer
@@ -2762,7 +2762,7 @@ void spu_device::process_until(const unsigned int tsample)
process_samples,
isreverb?reverbptr:outptr,
isnoise?noiseptr
- :(isfm?fmptr:NULL),
+ :(isfm?fmptr:NULL),
isfmin?fmptr:NULL,
&tleft))
{
@@ -2805,7 +2805,7 @@ void spu_device::sound_stream_update(sound_stream &stream, stream_sample_t **inp
outL = outputs[0];
outR = outputs[1];
- generate(temp, samples*4); // second parameter is bytes, * 2 (size of INT16) * 2 (stereo)
+ generate(temp, samples*4); // second parameter is bytes, * 2 (size of INT16) * 2 (stereo)
src = &temp[0];
for (int i = 0; i < samples; i++)
@@ -2848,7 +2848,7 @@ void spu_device::start_dma(UINT8 *mainram, bool to_spu, UINT32 size)
//
void spu_device::decode_xa_mono(const unsigned char *xa,
- unsigned char *ptr)
+ unsigned char *ptr)
{
signed short *dp=(signed short *)ptr;
@@ -2903,7 +2903,7 @@ void spu_device::decode_xa_mono(const unsigned char *xa,
//
void spu_device::decode_xa_stereo(const unsigned char *xa,
- unsigned char *ptr)
+ unsigned char *ptr)
{
signed short *dp=(signed short *)ptr;
@@ -2984,11 +2984,11 @@ bool spu_device::play_xa(const unsigned int sector, const unsigned char *xa)
float freq;
int channels;
- switch (hdr[3]&0x3f) // ignore emphasis and reserved bits
+ switch (hdr[3]&0x3f) // ignore emphasis and reserved bits
{
case 0:
channels=1;
- freq=37800.0f; //18900.0f;
+ freq=37800.0f; //18900.0f;
break;
case 1:
@@ -2998,12 +2998,12 @@ bool spu_device::play_xa(const unsigned int sector, const unsigned char *xa)
case 4:
channels=1;
- freq=18900.0f; ///2.0f;
+ freq=18900.0f; ///2.0f;
break;
case 5:
channels=2;
- freq=18900.0f; //37800.0f/2.0f;
+ freq=18900.0f; //37800.0f/2.0f;
break;
default: