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() { |
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) { |
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>* 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. |