2 |
* * |
* * |
3 |
* LinuxSampler - modular, streaming capable sampler * |
* LinuxSampler - modular, streaming capable sampler * |
4 |
* * |
* * |
5 |
* Copyright (C) 2003 by Benno Senoner * |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
6 |
|
* Copyright (C) 2005 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 * |
30 |
# warning Stream.h included |
# warning Stream.h included |
31 |
#endif // DEBUG_HEADERS |
#endif // DEBUG_HEADERS |
32 |
|
|
33 |
|
#include <gig.h> |
34 |
|
|
35 |
#include "../../common/RingBuffer.h" |
#include "../../common/RingBuffer.h" |
|
#include "../../lib/fileloader/libgig/gig.h" |
|
36 |
|
|
37 |
namespace LinuxSampler { namespace gig { |
namespace LinuxSampler { namespace gig { |
38 |
|
|
54 |
}; |
}; |
55 |
|
|
56 |
// Methods |
// Methods |
57 |
Stream(uint BufferSize, uint BufferWrapElements); |
Stream( ::gig::buffer_t* pDecompressionBuffer, uint BufferSize, uint BufferWrapElements); |
58 |
~Stream(); |
virtual ~Stream(); |
59 |
int ReadAhead(unsigned long SampleCount); |
int ReadAhead(unsigned long SampleCount); |
60 |
void WriteSilence(unsigned long SilenceSampleWords); |
void WriteSilence(unsigned long SilenceSampleWords); |
61 |
|
|
62 |
inline int GetReadSpace() { |
inline int GetReadSpace() { |
63 |
return (pRingBuffer && State == state_active) ? pRingBuffer->read_space() : 0; |
return (pRingBuffer && State != state_unused) ? pRingBuffer->read_space() : 0; |
64 |
} |
} |
65 |
|
|
66 |
inline int GetWriteSpace() { |
inline int GetWriteSpace() { |
114 |
::gig::playback_state_t PlaybackState; |
::gig::playback_state_t PlaybackState; |
115 |
RingBuffer<sample_t>* pRingBuffer; |
RingBuffer<sample_t>* pRingBuffer; |
116 |
bool DoLoop; |
bool DoLoop; |
117 |
|
::gig::buffer_t* pDecompressionBuffer; |
118 |
|
|
119 |
// Static Attributes |
// Static Attributes |
120 |
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. |
121 |
|
static uint TotalStreams; //< Reflects how many stream objects currently exist. |
122 |
|
|
123 |
// Methods |
// Methods |
124 |
inline void Reset() { |
inline void Reset() { |