summaryrefslogtreecommitdiff
path: root/apps/codecs/libspc/spc_dsp.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/libspc/spc_dsp.c')
-rw-r--r--apps/codecs/libspc/spc_dsp.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/apps/codecs/libspc/spc_dsp.c b/apps/codecs/libspc/spc_dsp.c
index d1facf89a2..9ebd3e6353 100644
--- a/apps/codecs/libspc/spc_dsp.c
+++ b/apps/codecs/libspc/spc_dsp.c
@@ -77,12 +77,13 @@ static void decode_brr( struct Spc_Dsp* this, unsigned start_addr,
77 /* setup same variables as where decode_brr() is called from */ 77 /* setup same variables as where decode_brr() is called from */
78 #undef RAM 78 #undef RAM
79 #define RAM ram.ram 79 #define RAM ram.ram
80
80 struct src_dir const* const sd = 81 struct src_dir const* const sd =
81 (struct src_dir*) &RAM [this->r.g.wave_page * 0x100]; 82 &ram.sd[this->r.g.wave_page * 0x100/sizeof(struct src_dir)];
82 struct cache_entry_t* const wave_entry = 83 struct cache_entry_t* const wave_entry =
83 &this->wave_entry [raw_voice->waveform]; 84 &this->wave_entry [raw_voice->waveform];
84 85
85 /* the following block can be put in place of the call to 86 /* the following block can be put in place of the call to
86 decode_brr() below 87 decode_brr() below
87 */ 88 */
88 { 89 {
@@ -106,7 +107,7 @@ static void decode_brr( struct Spc_Dsp* this, unsigned start_addr,
106 wave_entry->start_addr = start_addr; 107 wave_entry->start_addr = start_addr;
107 108
108 uint8_t const* const loop_ptr = 109 uint8_t const* const loop_ptr =
109 RAM + GET_LE16A( sd [raw_voice->waveform].loop ); 110 RAM + letoh16(sd[raw_voice->waveform].loop);
110 short* loop_start = 0; 111 short* loop_start = 0;
111 112
112 short* out = BRRcache + start_addr * 2; 113 short* out = BRRcache + start_addr * 2;
@@ -251,7 +252,7 @@ static void key_on(struct Spc_Dsp* const this, struct voice_t* const voice,
251 voice->envx = 0; 252 voice->envx = 0;
252 voice->env_mode = state_attack; 253 voice->env_mode = state_attack;
253 voice->env_timer = env_rate_init; /* TODO: inaccurate? */ 254 voice->env_timer = env_rate_init; /* TODO: inaccurate? */
254 unsigned start_addr = GET_LE16A(sd [raw_voice->waveform].start); 255 unsigned start_addr = letoh16(sd[raw_voice->waveform].start);
255 #if !SPC_BRRCACHE 256 #if !SPC_BRRCACHE
256 { 257 {
257 voice->addr = RAM + start_addr; 258 voice->addr = RAM + start_addr;
@@ -331,9 +332,9 @@ void DSP_run_( struct Spc_Dsp* this, long count, int32_t* out_buf )
331 } 332 }
332 while ( (vbit >>= 1) != 0 ); 333 while ( (vbit >>= 1) != 0 );
333 } 334 }
334 335
335 struct src_dir const* const sd = 336 struct src_dir const* const sd =
336 (struct src_dir*) &RAM [this->r.g.wave_page * 0x100]; 337 &ram.sd[this->r.g.wave_page * 0x100/sizeof(struct src_dir)];
337 338
338 #ifdef ROCKBOX_BIG_ENDIAN 339 #ifdef ROCKBOX_BIG_ENDIAN
339 /* Convert endiannesses before entering loops - these 340 /* Convert endiannesses before entering loops - these
@@ -358,7 +359,7 @@ void DSP_run_( struct Spc_Dsp* this, long count, int32_t* out_buf )
358 const int echo_start = this->r.g.echo_page * 0x100; 359 const int echo_start = this->r.g.echo_page * 0x100;
359 #endif /* CPU_COLDFIRE */ 360 #endif /* CPU_COLDFIRE */
360 #else 361 #else
361 #define VOICE_RATE(x) (INT16A(raw_voice->rate) & 0x3FFF) 362 #define VOICE_RATE(x) (GET_LE16(raw_voice->rate) & 0x3FFF)
362 #define IF_RBE(...) 363 #define IF_RBE(...)
363 #endif /* ROCKBOX_BIG_ENDIAN */ 364 #endif /* ROCKBOX_BIG_ENDIAN */
364 365
@@ -590,7 +591,7 @@ void DSP_run_( struct Spc_Dsp* this, long count, int32_t* out_buf )
590 /* action based on previous block's header */ 591 /* action based on previous block's header */
591 if ( voice->block_header & 1 ) 592 if ( voice->block_header & 1 )
592 { 593 {
593 addr = RAM + GET_LE16A( sd [raw_voice->waveform].loop ); 594 addr = RAM + letoh16(sd[raw_voice->waveform].loop);
594 this->r.g.wave_ended |= vbit; 595 this->r.g.wave_ended |= vbit;
595 if ( !(voice->block_header & 2) ) /* 1% of the time */ 596 if ( !(voice->block_header & 2) ) /* 1% of the time */
596 { 597 {