/[svn]/linuxsampler/trunk/src/engines/gig/Synthesizer.h
ViewVC logotype

Diff of /linuxsampler/trunk/src/engines/gig/Synthesizer.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 411 by schoenebeck, Sat Feb 26 02:01:14 2005 UTC revision 424 by schoenebeck, Fri Mar 4 22:54:11 2005 UTC
# Line 70  namespace LinuxSampler { namespace gig { Line 70  namespace LinuxSampler { namespace gig {
70          public:          public:
71              template<typename VOICE_T>              template<typename VOICE_T>
72              inline static void SynthesizeFragment(VOICE_T& Voice, uint Samples, sample_t* pSrc, uint i) {              inline static void SynthesizeFragment(VOICE_T& Voice, uint Samples, sample_t* pSrc, uint i) {
73                    const float panLeft  = Mul(Voice.PanLeft,  Voice.pEngineChannel->GlobalPanLeft);
74                    const float panRight = Mul(Voice.PanRight, Voice.pEngineChannel->GlobalPanRight);
75                  if (IMPLEMENTATION == ASM_X86_MMX_SSE) {                  if (IMPLEMENTATION == ASM_X86_MMX_SSE) {
76                      float fPos = (float) Voice.Pos;                      float fPos = (float) Voice.Pos;
77                      SynthesizeFragment(Voice, Samples, pSrc, i, Voice.pSample->LoopPlayCount,                      SynthesizeFragment(Voice, Samples, pSrc, i, Voice.pSample->LoopPlayCount,
# Line 79  namespace LinuxSampler { namespace gig { Line 81  namespace LinuxSampler { namespace gig {
81                                         Voice.LoopCyclesLeft,                                         Voice.LoopCyclesLeft,
82                                         (void *)&fPos,                                         (void *)&fPos,
83                                         Voice.PitchBase,                                         Voice.PitchBase,
84                                         Voice.PitchBend);                                         Voice.PitchBend,
85                                           &panLeft, &panRight);
86                      #if  ARCH_X86                      #if  ARCH_X86
87                      if (INTERPOLATE) EMMS;                      if (INTERPOLATE) EMMS;
88                      #endif                      #endif
# Line 92  namespace LinuxSampler { namespace gig { Line 95  namespace LinuxSampler { namespace gig {
95                                         Voice.LoopCyclesLeft,                                         Voice.LoopCyclesLeft,
96                                         (void *)&Voice.Pos,                                         (void *)&Voice.Pos,
97                                         Voice.PitchBase,                                         Voice.PitchBase,
98                                         Voice.PitchBend);                                         Voice.PitchBend,
99                                           &panLeft, &panRight);
100                  }                  }
101              }              }
102    
103          //protected:          //protected:
104    
105              template<typename VOICE_T>              template<typename VOICE_T>
106              inline static void SynthesizeFragment(VOICE_T& Voice, uint Samples, sample_t* pSrc, uint& i, uint& LoopPlayCount, uint LoopStart, uint LoopEnd, uint LoopSize, uint& LoopCyclesLeft, void* Pos, float& PitchBase, float& PitchBend) {              inline static void SynthesizeFragment(VOICE_T& Voice, uint Samples, sample_t* pSrc, uint& i, uint& LoopPlayCount, uint LoopStart, uint LoopEnd, uint LoopSize, uint& LoopCyclesLeft, void* Pos, float& PitchBase, float& PitchBend, const float* PanLeft, const float* PanRight) {
107                  const float loopEnd = Float(LoopEnd);                  const float loopEnd = Float(LoopEnd);
108                  const float PBbyPB = Mul(PitchBase, PitchBend);                  const float PBbyPB = Mul(PitchBase, PitchBend);
109                  const float f_LoopStart = Float(LoopStart);                  const float f_LoopStart = Float(LoopStart);
# Line 110  namespace LinuxSampler { namespace gig { Line 114  namespace LinuxSampler { namespace gig {
114                          while (i < Samples && LoopCyclesLeft) {                          while (i < Samples && LoopCyclesLeft) {
115                              if (CONSTPITCH) {                              if (CONSTPITCH) {
116                                  const uint processEnd = Min(Samples, i + DiffToLoopEnd(loopEnd,Pos, PBbyPB) + 1); //TODO: instead of +1 we could also round up                                  const uint processEnd = Min(Samples, i + DiffToLoopEnd(loopEnd,Pos, PBbyPB) + 1); //TODO: instead of +1 we could also round up
117                                  while (i < processEnd) Synthesize(Voice, Pos, pSrc, i);                                  while (i < processEnd) Synthesize(Voice, Pos, pSrc, i, PanLeft, PanRight);
118                              }                              }
119                              else Synthesize(Voice, Pos, pSrc, i);                              else Synthesize(Voice, Pos, pSrc, i, PanLeft, PanRight);
120                              if (WrapLoop(f_LoopStart, f_LoopSize, loopEnd, Pos)) LoopCyclesLeft--;                              if (WrapLoop(f_LoopStart, f_LoopSize, loopEnd, Pos)) LoopCyclesLeft--;
121                          }                          }
122                          // render on without loop                          // render on without loop
123                          while (i < Samples) Synthesize(Voice, Pos, pSrc, i);                          while (i < Samples) Synthesize(Voice, Pos, pSrc, i, PanLeft, PanRight);
124                      }                      }
125                      else { // render loop (endless loop)                      else { // render loop (endless loop)
126                          while (i < Samples) {                          while (i < Samples) {
127                              if (CONSTPITCH) {                              if (CONSTPITCH) {
128                                  const uint processEnd = Min(Samples, i + DiffToLoopEnd(loopEnd, Pos, PBbyPB) + 1); //TODO: instead of +1 we could also round up                                  const uint processEnd = Min(Samples, i + DiffToLoopEnd(loopEnd, Pos, PBbyPB) + 1); //TODO: instead of +1 we could also round up
129                                  while (i < processEnd) Synthesize(Voice, Pos, pSrc, i);                                  while (i < processEnd) Synthesize(Voice, Pos, pSrc, i, PanLeft, PanRight);
130                              }                              }
131                              else Synthesize(Voice, Pos, pSrc, i);                              else Synthesize(Voice, Pos, pSrc, i, PanLeft, PanRight);
132                              WrapLoop(f_LoopStart, f_LoopSize, loopEnd, Pos);                              WrapLoop(f_LoopStart, f_LoopSize, loopEnd, Pos);
133                          }                          }
134                      }                      }
135                  }                  }
136                  else { // no looping                  else { // no looping
137                      while (i < Samples) { Synthesize(Voice, Pos, pSrc, i);}                      while (i < Samples) { Synthesize(Voice, Pos, pSrc, i, PanLeft, PanRight);}
138                  }                  }
139              }              }
140    
141              template<typename VOICE_T>              template<typename VOICE_T>
142              inline static void Synthesize(VOICE_T& Voice, void* Pos, sample_t* pSrc, uint& i) {              inline static void Synthesize(VOICE_T& Voice, void* Pos, sample_t* pSrc, uint& i, const float* PanLeft, const float* PanRight) {
143                  Synthesize(pSrc, Pos,                  Synthesize(pSrc, Pos,
144                             Voice.pEngine->pSynthesisParameters[Event::destination_vco][i],                             Voice.pEngine->pSynthesisParameters[Event::destination_vco][i],
145                             Voice.pEngineChannel->pOutputLeft,                             Voice.pEngineChannel->pOutputLeft,
146                             Voice.pEngineChannel->pOutputRight,                             Voice.pEngineChannel->pOutputRight,
147                             i,                             i,
148                             Voice.pEngine->pSynthesisParameters[Event::destination_vca],                             Voice.pEngine->pSynthesisParameters[Event::destination_vca],
149                             &Voice.PanLeft,                             PanLeft,
150                             &Voice.PanRight,                             PanRight,
151                             Voice.FilterLeft,                             Voice.FilterLeft,
152                             Voice.FilterRight,                             Voice.FilterRight,
153                             Voice.pEngine->pBasicFilterParameters[i],                             Voice.pEngine->pBasicFilterParameters[i],
# Line 220  namespace LinuxSampler { namespace gig { Line 224  namespace LinuxSampler { namespace gig {
224                  }                  }
225              }              }
226    
227              inline static void Synthesize(sample_t* pSrc, void* Pos, float& Pitch, float* pOutL, float* pOutR, uint& i, float* Volume, float* PanL, float* PanR, Filter& FilterL, Filter& FilterR, biquad_param_t& bqBase, biquad_param_t& bqMain) {              inline static void Synthesize(sample_t* pSrc, void* Pos, float& Pitch, float* pOutL, float* pOutR, uint& i, float* Volume, const float* PanL, const float* PanR, Filter& FilterL, Filter& FilterR, biquad_param_t& bqBase, biquad_param_t& bqMain) {
228                  switch (IMPLEMENTATION) {                  switch (IMPLEMENTATION) {
229                      // pure C++ implementation (thus platform independent)                      // pure C++ implementation (thus platform independent)
230                      case CPP: {                      case CPP: {

Legend:
Removed from v.411  
changed lines
  Added in v.424

  ViewVC Help
Powered by ViewVC