~ubuntu-branches/debian/jessie/scummvm/jessie

« back to all changes in this revision

Viewing changes to audio/musicplugin.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Moritz Muehlenhoff
  • Date: 2011-05-25 19:02:23 UTC
  • mto: This revision was merged to the branch mainline in revision 23.
  • Revision ID: james.westby@ubuntu.com-20110525190223-fiqm0oaec714xk31
Tags: upstream-1.3.0
ImportĀ upstreamĀ versionĀ 1.3.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 * $URL$
 
22
 * $Id$
 
23
 *
 
24
 */
 
25
 
 
26
#include "audio/musicplugin.h"
 
27
#include "common/hash-str.h"
 
28
#include "common/translation.h"
 
29
 
 
30
MusicDevice::MusicDevice(MusicPluginObject const *musicPlugin, Common::String name, MusicType mt) :
 
31
        _musicDriverName(_(musicPlugin->getName())), _musicDriverId(musicPlugin->getId()),
 
32
        _name(_(name)), _type(mt) {
 
33
}
 
34
 
 
35
Common::String MusicDevice::getCompleteName() {
 
36
        Common::String name;
 
37
 
 
38
        if (_name.empty()) {
 
39
                // Default device, just show the driver name
 
40
                name = _musicDriverName;
 
41
        } else {
 
42
                // Show both device and driver names
 
43
                name = _name;
 
44
                name += " [";
 
45
                name += _musicDriverName;
 
46
                name += "]";
 
47
        }
 
48
 
 
49
        return name;
 
50
}
 
51
 
 
52
Common::String MusicDevice::getCompleteId() {
 
53
        Common::String id = _musicDriverId;
 
54
        if (!_name.empty()) {
 
55
                id += "_";
 
56
                id += _name;
 
57
        }
 
58
 
 
59
        return id;
 
60
}
 
61
 
 
62
MidiDriver::DeviceHandle MusicDevice::getHandle() {
 
63
        return (MidiDriver::DeviceHandle)Common::hashit(getCompleteId().c_str());
 
64
}