cd_drive.h
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2013 The ClanLib Team
4 **
5 ** This software is provided 'as-is', without any express or implied
6 ** warranty. In no event will the authors be held liable for any damages
7 ** arising from the use of this software.
8 **
9 ** Permission is granted to anyone to use this software for any purpose,
10 ** including commercial applications, and to alter it and redistribute it
11 ** freely, subject to the following restrictions:
12 **
13 ** 1. The origin of this software must not be misrepresented; you must not
14 ** claim that you wrote the original software. If you use this software
15 ** in a product, an acknowledgment in the product documentation would be
16 ** appreciated but is not required.
17 ** 2. Altered source versions must be plainly marked as such, and must not be
18 ** misrepresented as being the original software.
19 ** 3. This notice may not be removed or altered from any source distribution.
20 **
21 ** Note: Some of the libraries ClanLib may link to may have additional
22 ** requirements or restrictions.
23 **
24 ** File Author(s):
25 **
26 ** (if your name is missing here, please add it)
27 */
28 
29 
30 #pragma once
31 
32 #include "api_sound.h"
33 #include <memory>
34 #include <vector>
35 
36 namespace clan
37 {
40 
41 class CDDrive_Impl;
42 
46 class CL_API_SOUND CDDrive
47 {
50 
51 public:
55  CDDrive();
56 
57  virtual ~CDDrive();
58 
62 
63 public:
65  static std::vector<CDDrive> &get_drives();
66 
68  bool is_null() const { return !impl; }
69 
71  void throw_if_null() const;
72 
74  std::string get_drive_path();
75 
77  std::string get_cd_name();
78 
80  int get_num_tracks();
81 
83  bool is_playing();
84 
86  int get_cur_track();
87 
89  int get_cur_frame();
90 
94 
95 public:
100  bool play_tracks(int track, int end_track=0);
101 
106  bool play_frames(int frame, int end_frame=0);
107 
109  bool play_track(int track);
110 
112  void stop();
113 
115  void pause();
116 
118  void resume();
119 
123 
124 private:
125  std::shared_ptr<CDDrive_Impl> impl;
127 };
128 
129 }
130 
bool is_null() const
Returns true if this object is invalid.
Definition: cd_drive.h:68
CD drive audio interface.
Definition: cd_drive.h:46