summaryrefslogblamecommitdiffstats
path: root/src/osc_sound.c
blob: dd4eda579010d089c5647f916b0a6f8f265e56e7 (plain) (tree)

































                                                                                                    
#include "osc.h"

#include <stdlib.h>

osc_t OSC_sound = {
  .name = "w_sound",
  .data = 0,
  .len = 0,
  .start = 0,
  .end = 0,
  .type = SAMPLE,
};

OSC_COMMON(sound)

float
osc_sound(float offset)
{
  if (!OSC_sound.len) {
    //osc_load_wav(&OSC_sound, "/home/gramanas/code/synth-project/waves/test2.wav");
    osc_load_wav(&OSC_sound, "/home/gramanas/code/synth-project/waves/test_lick.wav");
    /* osc_load_wav(&OSC_sound, "/mnt/data/music/samples/velvet/Drums/Kick/Kick Coldwire 1.wav"); */
  }
  
  return osc_interpolate(offset,
                         OSC_sound.data[(int)offset],
                         OSC_sound.data[osc_next_index(&OSC_sound, offset)]);
}

float
osc_sound_next(float f, float offset)
{
  return osc_next_offset(&OSC_sound, f, offset);
}