@@ -35,7 +35,6 @@ SampleChannel::SampleChannel()
3535, overdubProtection(false )
3636, mode(SamplePlayerMode::SINGLE_BASIC)
3737, pitch(G_DEFAULT_PITCH)
38- , shift(0 )
3938, velocityAsVol(false )
4039{
4140}
@@ -47,7 +46,6 @@ SampleChannel::SampleChannel(const Patch::Channel& p, const SceneArray<Sample>&
4746, overdubProtection(p.overdubProtection)
4847, mode(p.mode)
4948, pitch(p.pitch)
50- , shift(p.shift)
5149, velocityAsVol(p.midiInVeloAsVol)
5250{
5351 std::size_t scene = 0 ;
@@ -109,6 +107,10 @@ SampleRange SampleChannel::getRange(std::size_t scene) const { return m_samples[
109107
110108/* -------------------------------------------------------------------------- */
111109
110+ Frame SampleChannel::getShift (std::size_t scene) const { return m_samples[scene].shift ; }
111+
112+ /* -------------------------------------------------------------------------- */
113+
112114const SceneArray<Sample>& SampleChannel::getSamples () const { return m_samples; }
113115
114116/* -------------------------------------------------------------------------- */
@@ -120,14 +122,13 @@ Frame SampleChannel::getWaveSize(std::size_t scene) const
120122
121123/* -------------------------------------------------------------------------- */
122124
123- void SampleChannel::loadSample (const Sample& s, std::size_t scene, Frame newShift )
125+ void SampleChannel::loadSample (const Sample& s, std::size_t scene)
124126{
125127 m_samples[scene] = {s.wave , {}};
126- shift = 0 ;
127128
128129 if (s.wave != nullptr )
129130 {
130- shift = newShift == -1 ? 0 : newShift ;
131+ m_samples[scene]. shift = s. shift == -1 ? 0 : s. shift ;
131132 m_samples[scene].range = s.range .isValid () ? s.range : SampleRange (0 , s.wave ->getBuffer ().countFrames ());
132133 }
133134}
@@ -144,7 +145,7 @@ void SampleChannel::setWave(Wave* w, std::size_t scene, float samplerateRatio)
144145 if (samplerateRatio != 1 .0f )
145146 {
146147 m_samples[scene].range *= samplerateRatio;
147- shift *= samplerateRatio;
148+ m_samples[scene]. shift *= samplerateRatio;
148149 }
149150}
150151
@@ -162,4 +163,10 @@ void SampleChannel::setSample(const Sample& sample, std::size_t scene, float sam
162163 setWave (sample.wave , scene, samplerateRatio);
163164 setRange (sample.range , scene);
164165}
166+ /* -------------------------------------------------------------------------- */
167+
168+ void SampleChannel::setShift (Frame shift, std::size_t scene)
169+ {
170+ m_samples[scene].shift = shift;
171+ }
165172} // namespace giada::m
0 commit comments