openshot-audio  0.1.2
juce_AudioCDReader.h
Go to the documentation of this file.
1 /*
2  ==============================================================================
3 
4  This file is part of the JUCE library.
5  Copyright (c) 2015 - ROLI Ltd.
6 
7  Permission is granted to use this software under the terms of either:
8  a) the GPL v2 (or any later version)
9  b) the Affero GPL v3
10 
11  Details of these licenses can be found at: www.gnu.org/licenses
12 
13  JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
14  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15  A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 
17  ------------------------------------------------------------------------------
18 
19  To release a closed-source product which uses JUCE, commercial licenses are
20  available: visit www.juce.com for more information.
21 
22  ==============================================================================
23 */
24 
25 #ifndef JUCE_AUDIOCDREADER_H_INCLUDED
26 #define JUCE_AUDIOCDREADER_H_INCLUDED
27 
28 #if JUCE_USE_CDREADER || DOXYGEN
29 
30 
31 //==============================================================================
41 class JUCE_API AudioCDReader : public AudioFormatReader
42 {
43 public:
44  //==============================================================================
53  static StringArray getAvailableCDNames();
54 
62  static AudioCDReader* createReaderForCD (const int index);
63 
64  //==============================================================================
66  ~AudioCDReader();
67 
69  bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer,
70  int64 startSampleInFile, int numSamples) override;
71 
73  bool isCDStillPresent() const;
74 
76  int getNumTracks() const;
77 
82  int getPositionOfTrackStart (int trackNum) const;
83 
87  bool isTrackAudio (int trackNum) const;
88 
92  const Array<int>& getTrackOffsets() const;
93 
100  void refreshTrackLengths();
101 
105  void enableIndexScanning (bool enabled);
106 
120  int getLastIndex() const;
121 
127  Array<int> findIndexesInTrack (const int trackNumber);
128 
132  int getCDDBId();
133 
137  void ejectDisk();
138 
139  //==============================================================================
140  enum
141  {
142  framesPerSecond = 75,
143  samplesPerFrame = 44100 / framesPerSecond
144  };
145 
146 private:
147  //==============================================================================
148  Array<int> trackStartSamples;
149 
150  #if JUCE_MAC
151  File volumeDir;
152  Array<File> tracks;
153  int currentReaderTrack;
155  AudioCDReader (const File& volume);
156 
157  #elif JUCE_WINDOWS
158  bool audioTracks [100];
159  void* handle;
160  MemoryBlock buffer;
161  bool indexingEnabled;
162  int lastIndex, firstFrameInBuffer, samplesInBuffer;
163  AudioCDReader (void* handle);
164  int getIndexAt (int samplePos);
165 
166  #elif JUCE_LINUX
167  AudioCDReader();
168  #endif
169 
171 };
172 
173 #endif
174 #endif // JUCE_AUDIOCDREADER_H_INCLUDED
Definition: juce_MemoryBlock.h:38
#define JUCE_API
Definition: juce_StandardHeader.h:139
const int samplesPerFrame
Definition: juce_win32_AudioCDReader.cpp:955
Definition: juce_AudioFormatReader.h:38
long long int64
Definition: juce_MathsFunctions.h:60
Definition: juce_StringArray.h:39
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
Definition: juce_PlatformDefs.h:198
virtual bool readSamples(int **destSamples, int numDestChannels, int startOffsetInDestBuffer, int64 startSampleInFile, int numSamples)=0
Definition: juce_File.h:45