comparison base/PlayParameters.cpp @ 0:fc9323a41f5a

start base : Sonic Visualiser sv1-1.0rc1
author lbajardsilogic
date Fri, 11 May 2007 09:08:14 +0000
parents
children b3c3a5fa185f
comparison
equal deleted inserted replaced
-1:000000000000 0:fc9323a41f5a
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2
3 /*
4 Sonic Visualiser
5 An audio file viewer and annotation editor.
6 Centre for Digital Music, Queen Mary, University of London.
7 This file copyright 2006 Chris Cannam.
8
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License as
11 published by the Free Software Foundation; either version 2 of the
12 License, or (at your option) any later version. See the file
13 COPYING included with this distribution for more information.
14 */
15
16 #include "PlayParameters.h"
17
18 #include <iostream>
19
20 QString
21 PlayParameters::toXmlString(QString indent,
22 QString extraAttributes) const
23 {
24 QString s;
25 s += indent;
26 s += QString("<playparameters mute=\"%1\" pan=\"%2\" gain=\"%3\" pluginId=\"%4\" %6")
27 .arg(m_playMuted ? "true" : "false")
28 .arg(m_playPan)
29 .arg(m_playGain)
30 .arg(m_playPluginId)
31 .arg(extraAttributes);
32 if (m_playPluginConfiguration != "") {
33 s += ">\n " + indent + m_playPluginConfiguration
34 + "\n" + indent + "</playparameters>\n";
35 } else {
36 s += "/>\n";
37 }
38 return s;
39 }
40
41 void
42 PlayParameters::setPlayMuted(bool muted)
43 {
44 // std::cerr << "PlayParameters: setPlayMuted(" << muted << ")" << std::endl;
45 m_playMuted = muted;
46 emit playMutedChanged(muted);
47 emit playAudibleChanged(!muted);
48 emit playParametersChanged();
49 }
50
51 void
52 PlayParameters::setPlayAudible(bool audible)
53 {
54 // std::cerr << "PlayParameters(" << this << "): setPlayAudible(" << audible << ")" << std::endl;
55 setPlayMuted(!audible);
56 }
57
58 void
59 PlayParameters::setPlayPan(float pan)
60 {
61 if (m_playPan != pan) {
62 m_playPan = pan;
63 emit playPanChanged(pan);
64 emit playParametersChanged();
65 }
66 }
67
68 void
69 PlayParameters::setPlayGain(float gain)
70 {
71 if (m_playGain != gain) {
72 m_playGain = gain;
73 emit playGainChanged(gain);
74 emit playParametersChanged();
75 }
76 }
77
78 void
79 PlayParameters::setPlayPluginId(QString id)
80 {
81 if (m_playPluginId != id) {
82 m_playPluginId = id;
83 emit playPluginIdChanged(id);
84 emit playParametersChanged();
85 }
86 }
87
88 void
89 PlayParameters::setPlayPluginConfiguration(QString configuration)
90 {
91 if (m_playPluginConfiguration != configuration) {
92 m_playPluginConfiguration = configuration;
93 // std::cerr << "PlayParameters(" << this << "): setPlayPluginConfiguration to \"" << configuration.toStdString() << "\"" << std::endl;
94 emit playPluginConfigurationChanged(configuration);
95 emit playParametersChanged();
96 }
97 }
98
99