logo

bytemedia

Home to byte-level sounds, images, videos, … git clone https://hacktivis.me/git/bytemedia.git

effects.h (214B)


  1. float
  2. crossfade(int dur, int t, float vol)
  3. {
  4. float att = dur/9;
  5. float decay = dur/3;
  6. if(t < att) {
  7. return vol*(t/att);
  8. } else if((dur-t) < decay) {
  9. return vol*((dur-t)/decay);
  10. } else {
  11. return vol;
  12. }
  13. }