41 |
* |
* |
42 |
* The disk reader thread is responsible for periodically refilling |
* The disk reader thread is responsible for periodically refilling |
43 |
* disk streams in parallel to the audio thread's rendering process. |
* disk streams in parallel to the audio thread's rendering process. |
44 |
|
* |
45 |
|
* There is also a function for releasing parts of instruments not |
46 |
|
* in use anymore (as this is not real time safe, the audio thread |
47 |
|
* cannot do it directly). |
48 |
*/ |
*/ |
49 |
class DiskThread : public Thread { |
class DiskThread : public Thread { |
50 |
public: |
public: |
51 |
// Methods |
// Methods |
52 |
DiskThread(uint BufferWrapElements); |
DiskThread(uint BufferWrapElements, InstrumentResourceManager* pInstruments); |
53 |
virtual ~DiskThread(); |
virtual ~DiskThread(); |
54 |
void Reset(); |
void Reset(); |
55 |
String GetBufferFillBytes(); |
String GetBufferFillBytes(); |
56 |
String GetBufferFillPercentage(); |
String GetBufferFillPercentage(); |
57 |
int OrderNewStream(Stream::reference_t* pStreamRef, ::gig::DimensionRegion* pDimRgn, unsigned long SampleOffset, bool DoLoop); |
int OrderNewStream(Stream::reference_t* pStreamRef, ::gig::DimensionRegion* pDimRgn, unsigned long SampleOffset, bool DoLoop); |
58 |
int OrderDeletionOfStream(Stream::reference_t* pStreamRef); |
int OrderDeletionOfStream(Stream::reference_t* pStreamRef); |
59 |
|
int OrderDeletionOfDimreg(::gig::DimensionRegion* dimreg); |
60 |
Stream* AskForCreatedStream(Stream::OrderID_t StreamOrderID); |
Stream* AskForCreatedStream(Stream::OrderID_t StreamOrderID); |
61 |
|
|
62 |
// the number of streams currently in usage |
// the number of streams currently in usage |
92 |
RingBuffer<create_command_t,false>* CreationQueue; ///< Contains commands to create streams |
RingBuffer<create_command_t,false>* CreationQueue; ///< Contains commands to create streams |
93 |
RingBuffer<delete_command_t,false>* DeletionQueue; ///< Contains commands to delete streams |
RingBuffer<delete_command_t,false>* DeletionQueue; ///< Contains commands to delete streams |
94 |
RingBuffer<Stream::Handle,false>* GhostQueue; ///< Contains handles to streams that are not used anymore and weren't deletable immediately |
RingBuffer<Stream::Handle,false>* GhostQueue; ///< Contains handles to streams that are not used anymore and weren't deletable immediately |
95 |
|
RingBuffer< ::gig::DimensionRegion*,false>* DeleteDimregQueue; ///< Contains dimension regions that are not used anymore and should be handed back to the instrument resource manager |
96 |
unsigned int RefillStreamsPerRun; ///< How many streams should be refilled in each loop run |
unsigned int RefillStreamsPerRun; ///< How many streams should be refilled in each loop run |
97 |
Stream* pStreams[CONFIG_MAX_STREAMS]; ///< Contains all disk streams (whether used or unused) |
Stream* pStreams[CONFIG_MAX_STREAMS]; ///< Contains all disk streams (whether used or unused) |
98 |
Stream* pCreatedStreams[CONFIG_MAX_STREAMS + 1]; ///< This is where the voice (audio thread) picks up it's meanwhile hopefully created disk stream. |
Stream* pCreatedStreams[CONFIG_MAX_STREAMS + 1]; ///< This is where the voice (audio thread) picks up it's meanwhile hopefully created disk stream. |
99 |
static Stream* SLOT_RESERVED; ///< This value is used to mark an entry in pCreatedStreams[] as reserved. |
static Stream* SLOT_RESERVED; ///< This value is used to mark an entry in pCreatedStreams[] as reserved. |
100 |
|
InstrumentResourceManager* pInstruments; ///< The instrument resource manager of the engine that is using this disk thread. Used by the dimension region deletion feature. |
101 |
|
|
102 |
// Methods |
// Methods |
103 |
void CreateStream(create_command_t& Command); |
void CreateStream(create_command_t& Command); |