Browse Source

Timeline: Avoid unaligned access.

tags/non-daw-v1.2.0
Jonathan Moore Liles 11 years ago
parent
commit
e578deb112
3 changed files with 10 additions and 1 deletions
  1. +8
    -0
      nonlib/dsp.C
  2. +1
    -0
      nonlib/dsp.h
  3. +1
    -1
      timeline/src/Engine/Audio_Region.C

+ 8
- 0
nonlib/dsp.C View File

@@ -45,6 +45,14 @@ buffer_apply_gain ( sample_t * __restrict__ buf, nframes_t nframes, float g )
*(buf_++) *= g;
}

void
buffer_apply_gain_unaligned ( sample_t * __restrict__ buf, nframes_t nframes, float g )
{
if ( g != 1.0f )
while ( nframes-- )
*(buf++) *= g;
}

void
buffer_apply_gain_buffer ( sample_t * __restrict__ buf, const sample_t * __restrict__ gainbuf, nframes_t nframes )
{


+ 1
- 0
nonlib/dsp.h View File

@@ -25,6 +25,7 @@

sample_t *buffer_alloc ( nframes_t size );
void buffer_apply_gain ( sample_t *buf, nframes_t nframes, float g );
void buffer_apply_gain_unaligned ( sample_t *buf, nframes_t nframes, float g );
void buffer_apply_gain_buffer ( sample_t *buf, const sample_t *gainbuf, nframes_t nframes );
void buffer_copy_and_apply_gain_buffer ( sample_t *dst, const sample_t *src, const sample_t *gainbuf, nframes_t nframes );
void buffer_mix ( sample_t *dst, const sample_t *src, nframes_t nframes );


+ 1
- 1
timeline/src/Engine/Audio_Region.C View File

@@ -192,7 +192,7 @@ Audio_Region::read ( sample_t *buf, nframes_t pos, nframes_t nframes, int channe

/* apply gain */

buffer_apply_gain( buf + ofs, cnt, _scale );
buffer_apply_gain_unaligned( buf + ofs, cnt, _scale );

/* perform declicking if necessary */



Loading…
Cancel
Save