# AudioSampleBuffer - Extra Methods?

**URL:** <https://forum.juce.com/t/audiosamplebuffer-extra-methods/9844>\
**Category:** General JUCE discussion\
**Created:** [January 17, 2013, 8:09pm UTC](https://forum.juce.com/t/audiosamplebuffer-extra-methods/9844 "2013-01-17T20:09:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jrlanglois](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/jrlanglois/32/21372_2.png) [@jrlanglois](https://forum.juce.com/u/jrlanglois)\
**Post date:** [January 17, 2013, 8:09pm UTC](https://forum.juce.com/t/audiosamplebuffer-extra-methods/9844/1 "2013-01-17T20:09:35Z")

</div>

Hey Jules,

Was wondering if you would be interested in extending the functionality of AudioSampleBuffer to reduce a bit of repetition? Here are some ideas:

```auto
/** Applies a gain multiple to all of the channels in their entirety */
void applyGain (float gain) noexcept
{
     applyGain (0, size, gain);
}
```

```auto
/** Applies a range of gains to all the channels, from their start to end*/
void applyGainRamp (float startGain, float endGain) noexcept
{
    applyGainRamp (0, size, startGain, endGain);
}
```

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [January 17, 2013, 8:35pm UTC](https://forum.juce.com/t/audiosamplebuffer-extra-methods/9844/2 "2013-01-17T20:35:58Z")

</div>

The first one: yes, good idea. But I think applyGainRamp should always take start and end positions, it doesn’t seem right to have an operation whose behaviour depends on a range without explicitly specifying that range.

---

<div class="post-metadata">

**Author:** ![jrlanglois](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/jrlanglois/32/21372_2.png) [@jrlanglois](https://forum.juce.com/u/jrlanglois)\
**Post date:** [January 17, 2013, 8:40pm UTC](https://forum.juce.com/t/audiosamplebuffer-extra-methods/9844/3 "2013-01-17T20:40:43Z")

</div>

> [@](#):
>
> But I think applyGainRamp should always take start and end positions, it doesn’t seem right to have an operation whose behaviour depends on a range without explicitly specifying that range.

Ah, that makes sense… fair enough!
