JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
juce_AudioCDReader.cpp
Go to the documentation of this file.
1 /*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11 Agreement and JUCE Privacy Policy.
12
13 End User License Agreement: www.juce.com/juce-7-licence
14 Privacy Policy: www.juce.com/juce-privacy-policy
15
16 Or: You may also use this code under the terms of the GPL v3 (see
17 www.gnu.org/licenses).
18
19 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
21 DISCLAIMED.
22
23 ==============================================================================
24*/
25
26namespace juce
27{
28
29#if JUCE_USE_CDREADER
30
32{
33 return trackStartSamples.size() - 1;
34}
35
37{
38 return trackStartSamples [trackNum];
39}
40
41const Array<int>& AudioCDReader::getTrackOffsets() const
42{
43 return trackStartSamples;
44}
45
47{
48 int checksum = 0;
49 const int numTracks = getNumTracks();
50
51 for (int i = 0; i < numTracks; ++i)
52 for (int offset = (trackStartSamples.getUnchecked (i) + 88200) / 44100; offset > 0; offset /= 10)
53 checksum += offset % 10;
54
55 const int length = (trackStartSamples.getLast() - trackStartSamples.getFirst()) / 44100;
56
57 // CCLLLLTT: checksum, length, tracks
58 return ((checksum & 0xff) << 24) | (length << 8) | numTracks;
59}
60
61#endif
62
63} // namespace juce
ElementType getUnchecked(int index) const
Returns one of the elements in the array, without checking the index passed in.
Definition juce_Array.h:252
int size() const noexcept
Returns the current number of elements in the array.
Definition juce_Array.h:215
ElementType getFirst() const noexcept
Returns the first element in the array, or a default value if the array is empty.
Definition juce_Array.h:290
ElementType getLast() const noexcept
Returns the last element in the array, or a default value if the array is empty.
Definition juce_Array.h:300
int getCDDBId()
Returns the CDDB id number for the CD.
int getPositionOfTrackStart(int trackNum) const
Finds the sample offset of the start of a track.
int getNumTracks() const
Returns the total number of tracks (audio + data).
const Array< int > & getTrackOffsets() const
Returns an array of sample offsets for the start of each track, followed by the sample position of th...
JUCE Namespace.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
Definition juce_Memory.h:88