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

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

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

revision 53 by schoenebeck, Mon Apr 26 17:15:51 2004 UTC revision 724 by iliev, Mon Jul 25 09:28:00 2005 UTC
# Line 2  Line 2 
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  *
# Line 25  Line 26 
26    
27  #include "../../common/global.h"  #include "../../common/global.h"
28    
29  #if DEBUG_HEADERS  #include <gig.h>
 # warning DiskThread.h included  
 #endif // DEBUG_HEADERS  
   
 #define REFILL_STREAMS_PER_RUN          4       ///< number of streams that should be refilled with each disk thread cycle  
 #define MIN_REFILL_SIZE                 1024    ///< if no buffer was filled up more than this bottom limit, the disk thread will go to sleep  
 #define MAX_REFILL_SIZE                 65536   ///< maximum of samples a buffer should be refilled in one cycle (256kB, as 16 bit stereo)  
 #define STREAM_BUFFER_SIZE              131072  ///< the diskstream ringbuffer size (256kB as sample_t is 16bit)  
 #define MAX_INPUT_STREAMS               100     ///< number of streams that should be allocated  
30    
31  #include "../../common/Thread.h"  #include "../../common/Thread.h"
32  #include "../../common/RingBuffer.h"  #include "../../common/RingBuffer.h"
# Line 44  namespace LinuxSampler { namespace gig { Line 37  namespace LinuxSampler { namespace gig {
37    
38      int CompareStreamWriteSpace(const void* a, const void* b);      int CompareStreamWriteSpace(const void* a, const void* b);
39    
40        /** @brief Disk Reader Thread
41         *
42         * The disk reader thread is responsible for periodically refilling
43         * disk streams in parallel to the audio thread's rendering process.
44         */
45      class DiskThread : public Thread {      class DiskThread : public Thread {
46          public:          public:
47              // Methods              // Methods
48              DiskThread(uint BufferWrapElements);              DiskThread(uint BufferWrapElements);
49             ~DiskThread();              virtual ~DiskThread();
50              void    Reset();              void    Reset();
51              String  GetBufferFillBytes();              String  GetBufferFillBytes();
52              String  GetBufferFillPercentage();              String  GetBufferFillPercentage();
# Line 62  namespace LinuxSampler { namespace gig { Line 60  namespace LinuxSampler { namespace gig {
60              int ActiveStreamCountMax;              int ActiveStreamCountMax;
61    
62          protected:          protected:
63                ::gig::buffer_t DecompressionBuffer; ///< Used for thread safe streaming.
64    
65              int Main(); ///< Implementation of virtual method from class Thread              int Main(); ///< Implementation of virtual method from class Thread
66    
67                friend class Stream;
68          private:          private:
69              // Private Types              // Private Types
70              struct create_command_t {              struct create_command_t {
# Line 86  namespace LinuxSampler { namespace gig { Line 88  namespace LinuxSampler { namespace gig {
88              RingBuffer<delete_command_t>*  DeletionQueue;                          ///< Contains commands to delete streams              RingBuffer<delete_command_t>*  DeletionQueue;                          ///< Contains commands to delete streams
89              RingBuffer<Stream::Handle>*    GhostQueue;                             ///< Contains handles to streams that are not used anymore and weren't deletable immediately              RingBuffer<Stream::Handle>*    GhostQueue;                             ///< Contains handles to streams that are not used anymore and weren't deletable immediately
90              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
91              Stream*                        pStreams[MAX_INPUT_STREAMS];            ///< Contains all disk streams (wether used or unused)              Stream*                        pStreams[CONFIG_MAX_STREAMS];            ///< Contains all disk streams (whether used or unused)
92              Stream*                        pCreatedStreams[MAX_INPUT_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.
93              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.
94    
95              // Methods              // Methods

Legend:
Removed from v.53  
changed lines
  Added in v.724

  ViewVC Help
Powered by ViewVC