Add TAL-Reverb-II plugin to test
[juce-lv2.git] / juce / source / src / audio / audio_file_formats / juce_AudioCDReader.cpp
blob40e82d02664b6a731172f7e20d4c4b8880c7deaf
1 /*
2 ==============================================================================
4 This file is part of the JUCE library - "Jules' Utility Class Extensions"
5 Copyright 2004-11 by Raw Material Software Ltd.
7 ------------------------------------------------------------------------------
9 JUCE can be redistributed and/or modified under the terms of the GNU General
10 Public License (Version 2), as published by the Free Software Foundation.
11 A copy of the license is included in the JUCE distribution, or can be found
12 online at www.gnu.org/licenses.
14 JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
15 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 A PARTICULAR PURPOSE. See the GNU General Public License for more details.
18 ------------------------------------------------------------------------------
20 To release a closed-source product which uses JUCE, commercial licenses are
21 available: visit www.rawmaterialsoftware.com/juce for more information.
23 ==============================================================================
26 #include "../../core/juce_StandardHeader.h"
28 #if JUCE_USE_CDREADER
30 BEGIN_JUCE_NAMESPACE
32 #include "juce_AudioCDReader.h"
35 //==============================================================================
36 int AudioCDReader::getNumTracks() const
38 return trackStartSamples.size() - 1;
41 int AudioCDReader::getPositionOfTrackStart (int trackNum) const
43 return trackStartSamples [trackNum];
46 const Array<int>& AudioCDReader::getTrackOffsets() const
48 return trackStartSamples;
51 int AudioCDReader::getCDDBId()
53 int checksum = 0;
54 const int numTracks = getNumTracks();
56 for (int i = 0; i < numTracks; ++i)
57 for (int offset = (trackStartSamples.getUnchecked(i) + 88200) / 44100; offset > 0; offset /= 10)
58 checksum += offset % 10;
60 const int length = (trackStartSamples.getLast() - trackStartSamples.getFirst()) / 44100;
62 // CCLLLLTT: checksum, length, tracks
63 return ((checksum & 0xff) << 24) | (length << 8) | numTracks;
67 END_JUCE_NAMESPACE
69 #endif