1 /* 2 * Copyright 2018 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef SAMPLES_GAMECONSTANTS_H 18 #define SAMPLES_GAMECONSTANTS_H 19 20 #include "ui/OpenGLFunctions.h" 21 22 constexpr int kBufferSizeInBursts = 2; // Use 2 bursts as the buffer size (double buffer) 23 constexpr int kMaxQueueItems = 4; // Must be power of 2 24 25 // Colors for game states and visual feedback for taps 26 constexpr ScreenColor kPlayingColor = GREY; 27 constexpr ScreenColor kLoadingColor = YELLOW; 28 constexpr ScreenColor kLoadingFailedColor = RED; 29 constexpr ScreenColor kTapSuccessColor = GREEN; 30 constexpr ScreenColor kTapEarlyColor = ORANGE; 31 constexpr ScreenColor kTapLateColor = PURPLE; 32 33 // This defines the size of the tap window in milliseconds. For example, if defined at 100ms the 34 // player will have 100ms before and after the centre of the tap window to tap on the screen and 35 // be successful 36 constexpr int kWindowCenterOffsetMs = 100; 37 38 // Filename for clap sound asset (in assets folder) 39 constexpr char kClapFilename[] { "CLAP.mp3" }; 40 41 // Filename for the backing track asset (in assets folder) 42 constexpr char kBackingTrackFilename[] { "FUNKY_HOUSE.mp3" }; 43 44 // The game will first demonstrate the pattern which the user should copy. It does this by 45 // "clapping" (playing a clap sound) at certain times during the song. We can specify these times 46 // here in milliseconds. Our backing track has a tempo of 120 beats per minute, which is 2 beats per 47 // second. This means a pattern of 3 claps starting on the first beat of the first bar would mean 48 // playing claps at 0ms, 500ms and 1000ms 49 constexpr int64_t kClapEvents[] { 0, 500, 1000 }; 50 51 // We then want the user to tap on the screen exactly 4 beats after the first clap so we add clap 52 // windows at 2000ms, 2500ms and 3000ms (or 2, 2.5 and 3 seconds). @see getTapResult for more info. 53 constexpr int64_t kClapWindows[] { 2000, 2500, 3000 }; 54 55 struct AudioProperties { 56 int32_t channelCount; 57 int32_t sampleRate; 58 }; 59 60 #endif //SAMPLES_GAMECONSTANTS_H