1 /* ScummVM - Graphic Adventure Engine 2 * 3 * ScummVM is the legal property of its developers, whose names 4 * are too numerous to list here. Please refer to the COPYRIGHT 5 * file distributed with this source distribution. 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 */ 22 23 #ifndef BACKENDS_AUDIOCD_ABSTRACT_H 24 #define BACKENDS_AUDIOCD_ABSTRACT_H 25 26 #include "common/scummsys.h" 27 #include "common/noncopyable.h" 28 29 /** 30 * Abstract Audio CD manager class. Subclasses implement the actual 31 * functionality. 32 */ 33 class AudioCDManager : Common::NonCopyable { 34 public: ~AudioCDManager()35 virtual ~AudioCDManager() {} 36 37 /** 38 * A structure containing the current playback information 39 */ 40 struct Status { 41 bool playing; 42 int track; 43 int start; 44 int duration; 45 int numLoops; 46 int volume; 47 int balance; 48 }; 49 50 /** 51 * Initialize the specified CD drive for audio playback. 52 * @return true if the CD drive was inited successfully 53 */ 54 virtual bool open() = 0; 55 56 /** 57 * Close the currently open CD drive 58 */ 59 virtual void close() = 0; 60 61 /** 62 * Start audio CD playback 63 * @param track the track to play. 64 * @param numLoops how often playback should be repeated (<=0 means infinitely often). 65 * @param startFrame the frame at which playback should start (75 frames = 1 second). 66 * @param duration the number of frames to play. 67 * @param onlyEmulate determines if the track should be emulated only 68 * @note The @c onlyEmulate parameter is deprecated. 69 * @return @c true if the track started playing, @c false otherwise 70 */ 71 virtual bool play(int track, int numLoops, int startFrame, int duration, bool onlyEmulate = false) = 0; 72 73 /** 74 * Get if audio is being played. 75 * @return true if CD audio is playing 76 */ 77 virtual bool isPlaying() const = 0; 78 79 /** 80 * Set the audio volume 81 */ 82 virtual void setVolume(byte volume) = 0; 83 84 /** 85 * Set the speakers balance 86 */ 87 virtual void setBalance(int8 balance) = 0; 88 89 /** 90 * Stop audio playback. 91 */ 92 virtual void stop() = 0; 93 94 /** 95 * Update audio status. 96 */ 97 virtual void update() = 0; 98 99 /** 100 * Get the playback status. 101 * @return a Status struct with playback data. 102 */ 103 virtual Status getStatus() const = 0; 104 }; 105 106 #endif 107