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

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

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

revision 865 by persson, Sun May 14 07:15:52 2006 UTC revision 970 by schoenebeck, Wed Dec 6 22:28:17 2006 UTC
# Line 3  Line 3 
3   *   LinuxSampler - modular, streaming capable sampler                     *   *   LinuxSampler - modular, streaming capable sampler                     *
4   *                                                                         *   *                                                                         *
5   *   Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck   *   *   Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck   *
6   *   Copyright (C) 2005 Christian Schoenebeck                              *   *   Copyright (C) 2005, 2006 Christian Schoenebeck                        *
7   *                                                                         *   *                                                                         *
8   *   This program is free software; you can redistribute it and/or modify  *   *   This program is free software; you can redistribute it and/or modify  *
9   *   it under the terms of the GNU General Public License as published by  *   *   it under the terms of the GNU General Public License as published by  *
# Line 67  namespace LinuxSampler { namespace gig { Line 67  namespace LinuxSampler { namespace gig {
67              void WriteSilence(unsigned long SilenceSampleWords);              void WriteSilence(unsigned long SilenceSampleWords);
68    
69              inline int GetReadSpace() {              inline int GetReadSpace() {
70                  return (pRingBuffer && State != state_unused) ? pRingBuffer->read_space()  : 0;                  return (pRingBuffer && State != state_unused) ? pRingBuffer->read_space() / BytesPerSample : 0;
71              }              }
72    
73              inline int GetWriteSpace() {              inline int GetWriteSpace() {
# Line 75  namespace LinuxSampler { namespace gig { Line 75  namespace LinuxSampler { namespace gig {
75              }              }
76    
77              inline int GetWriteSpaceToEnd() {              inline int GetWriteSpaceToEnd() {
78                  return (pRingBuffer && State == state_active) ? pRingBuffer->write_space_to_end_with_wrap() : 0;                  return (pRingBuffer && State == state_active) ? pRingBuffer->write_space_to_end_with_wrap() / BytesPerSample : 0;
79              }              }
80    
81              // adjusts the write space to avoid buffer boundaries which would lead to the wrap space              // adjusts the write space to avoid buffer boundaries which would lead to the wrap space
82              // within the buffer (needed for interpolation) getting filled only partially              // within the buffer (needed for interpolation) getting filled only partially
83              // for more infos see the docs in ringbuffer.h at adjust_write_space_to_avoid_boundary()              // for more infos see the docs in ringbuffer.h at adjust_write_space_to_avoid_boundary()
84              inline int AdjustWriteSpaceToAvoidBoundary(int cnt, int capped_cnt) {              inline int AdjustWriteSpaceToAvoidBoundary(int cnt, int capped_cnt) {
85                return pRingBuffer->adjust_write_space_to_avoid_boundary(cnt, capped_cnt);                return pRingBuffer->adjust_write_space_to_avoid_boundary(cnt * BytesPerSample, capped_cnt * BytesPerSample) / BytesPerSample;
             }  
   
             inline sample_t* GetReadPointer() {  
                 return pRingBuffer->get_read_ptr();  
86              }              }
87    
88              // gets the current read_ptr within the ringbuffer              // gets the current read_ptr within the ringbuffer
89              inline sample_t* GetReadPtr(void) {              inline uint8_t* GetReadPtr(void) {
90                  return pRingBuffer->get_read_ptr();                  return pRingBuffer->get_read_ptr();
91              }              }
92    
93              inline void IncrementReadPos(uint Count)  {              inline void IncrementReadPos(uint Count)  {
94                    Count *= BytesPerSample;
95                  uint leftspace = pRingBuffer->read_space();                  uint leftspace = pRingBuffer->read_space();
96                  pRingBuffer->increment_read_ptr(Min(Count, leftspace));                  pRingBuffer->increment_read_ptr(Min(Count, leftspace));
97                  if (State == state_end && Count >= leftspace) {                  if (State == state_end && Count >= leftspace) {
# Line 119  namespace LinuxSampler { namespace gig { Line 116  namespace LinuxSampler { namespace gig {
116              unsigned long            SampleOffset;              unsigned long            SampleOffset;
117              ::gig::DimensionRegion*  pDimRgn;              ::gig::DimensionRegion*  pDimRgn;
118              ::gig::playback_state_t  PlaybackState;              ::gig::playback_state_t  PlaybackState;
119              RingBuffer<sample_t>*    pRingBuffer;              RingBuffer<uint8_t,false>* pRingBuffer;
120              bool                     DoLoop;              bool                     DoLoop;
121              ::gig::buffer_t*         pDecompressionBuffer;              ::gig::buffer_t*         pDecompressionBuffer;
122                int                      BytesPerSample;
123    
124              // Static Attributes              // Static Attributes
125              static uint              UnusedStreams; //< Reflects how many stream objects of all stream instances are currently not in use.              static uint              UnusedStreams; //< Reflects how many stream objects of all stream instances are currently not in use.

Legend:
Removed from v.865  
changed lines
  Added in v.970

  ViewVC Help
Powered by ViewVC