/[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 333 by senkov, Sat Jan 1 08:18:07 2005 UTC revision 865 by persson, Sun May 14 07:15:52 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                              *
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 29  Line 30 
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    
39        /** @brief Buffered Disk Stream
40         *
41         * This encapsulation of a disk stream uses a ring buffer to allow
42         * thread safe refilling the stream's buffer with one thread (disk
43         * thread) and actual use / extraction of the audio data from the
44         * stream's buffer with another thread (audio thread).
45         */
46      class Stream {      class Stream {
47          public:          public:
48              // Member Types              // Member Types
# Line 52  namespace LinuxSampler { namespace gig { Line 61  namespace LinuxSampler { namespace gig {
61              };              };
62    
63              // Methods              // Methods
64              Stream(uint BufferSize, uint BufferWrapElements);              Stream( ::gig::buffer_t* pDecompressionBuffer, uint BufferSize, uint BufferWrapElements);
65             ~Stream();              virtual ~Stream();
66              int  ReadAhead(unsigned long SampleCount);              int  ReadAhead(unsigned long SampleCount);
67              void WriteSilence(unsigned long SilenceSampleWords);              void WriteSilence(unsigned long SilenceSampleWords);
68    
# Line 97  namespace LinuxSampler { namespace gig { Line 106  namespace LinuxSampler { namespace gig {
106              inline static uint       GetUnusedStreams() { return UnusedStreams; }              inline static uint       GetUnusedStreams() { return UnusedStreams; }
107          protected:          protected:
108              // Methods              // Methods
109              void                     Launch(Stream::Handle hStream, reference_t* pExportReference, ::gig::Sample* pSample, unsigned long SampleOffset, bool DoLoop);              void                     Launch(Stream::Handle hStream, reference_t* pExportReference, ::gig::DimensionRegion* pDimRgn, unsigned long SampleOffset, bool DoLoop);
110              inline void              Kill()      { pExportReference = NULL; Reset(); } ///< Will be called by disk thread after a 'deletion' command from the audio thread (within the voice class)              inline void              Kill()      { pExportReference = NULL; Reset(); } ///< Will be called by disk thread after a 'deletion' command from the audio thread (within the voice class)
111              inline Stream::Handle    GetHandle() { return hThis; }              inline Stream::Handle    GetHandle() { return hThis; }
112              inline Stream::state_t   GetState()  { return State; }              inline Stream::state_t   GetState()  { return State; }
# Line 108  namespace LinuxSampler { namespace gig { Line 117  namespace LinuxSampler { namespace gig {
117              state_t                  State;              state_t                  State;
118              Stream::Handle           hThis;              Stream::Handle           hThis;
119              unsigned long            SampleOffset;              unsigned long            SampleOffset;
120              ::gig::Sample*           pSample;              ::gig::DimensionRegion*  pDimRgn;
121              ::gig::playback_state_t  PlaybackState;              ::gig::playback_state_t  PlaybackState;
122              RingBuffer<sample_t>*    pRingBuffer;              RingBuffer<sample_t>*    pRingBuffer;
123              bool                     DoLoop;              bool                     DoLoop;
124                ::gig::buffer_t*         pDecompressionBuffer;
125    
126              // Static Attributes              // Static Attributes
127              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.
# Line 120  namespace LinuxSampler { namespace gig { Line 130  namespace LinuxSampler { namespace gig {
130              // Methods              // Methods
131              inline void Reset() {              inline void Reset() {
132                  SampleOffset                   = 0;                  SampleOffset                   = 0;
133                  pSample                        = NULL;                  pDimRgn                        = NULL;
134                  PlaybackState.position         = 0;                  PlaybackState.position         = 0;
135                  PlaybackState.reverse          = false;                  PlaybackState.reverse          = false;
136                  hThis                          = 0;                  hThis                          = 0;

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

  ViewVC Help
Powered by ViewVC