Music Hub ..
A session-wide music playback service
engine.cpp
Go to the documentation of this file.
1/*
2 * Copyright © 2013-2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Thomas Voß <thomas.voss@canonical.com>
17 * Jim Hodapp <jim.hodapp@canonical.com>
18 */
19
20#include "engine.h"
21
22#include <exception>
23#include <stdexcept>
24
25namespace media = core::ubuntu::media;
26
27double media::Engine::Volume::min()
28{
29 return 0.;
30}
31
32double media::Engine::Volume::max()
33{
34 return 1.;
35}
36
37media::Engine::Volume::Volume(double v) : value(v)
38{
39 if (value < min() || value > max())
40 throw std::runtime_error("Value exceeds limits");
41}
42
44{
45 return value != rhs.value;
46}
47
49{
50 return value == rhs.value;
51}
bool operator==(const Volume &rhs) const
Definition: engine.cpp:48
bool operator!=(const Volume &rhs) const
Definition: engine.cpp:43