3
* Copyright © 2004 Bastien Nocera <hadess@hadess.net>
4
* Copyright © 2002 David A. Schleef <ds@schleef.org>
5
* Copyright © 2006, 2008 Christian Persch
7
* This library is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU Library General Public
9
* License as published by the Free Software Foundation; either
10
* version 2 of the License, or (at your option) any later version.
12
* This library 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 GNU
15
* Library General Public License for more details.
17
* You should have received a copy of the GNU Library General Public
18
* License along with this library; if not, write to the
19
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20
* Boston, MA 02110-1301 USA.
29
#include "totemPlugin.h"
30
#include "totemConeAudio.h"
32
static const char *propertyNames[] = {
39
static const char *methodNames[] = {
43
TOTEM_IMPLEMENT_NPCLASS (totemConeAudio,
44
propertyNames, G_N_ELEMENTS (propertyNames),
45
methodNames, G_N_ELEMENTS (methodNames),
48
totemConeAudio::totemConeAudio (NPP aNPP)
49
: totemNPObject (aNPP),
56
totemConeAudio::~totemConeAudio ()
62
totemConeAudio::InvokeByIndex (int aIndex,
63
const NPVariant *argv,
67
TOTEM_LOG_INVOKE (aIndex, totemConeAudio);
69
switch (Methods (aIndex)) {
71
/* FIXMEchpe this sucks */
73
BOOLEAN_TO_NPVARIANT (!mMute, mute);
74
return SetPropertyByIndex (eMute, &mute);
82
totemConeAudio::GetPropertyByIndex (int aIndex,
85
TOTEM_LOG_GETTER (aIndex, totemConeAudio);
87
switch (Properties (aIndex)) {
89
return BoolVariant (_result, Plugin()->IsMute());
92
return Int32Variant (_result, Plugin()->Volume() * 200.0);
96
TOTEM_WARN_GETTER_UNIMPLEMENTED (aIndex, _result);
97
return VoidVariant (_result);
104
totemConeAudio::SetPropertyByIndex (int aIndex,
105
const NPVariant *aValue)
107
TOTEM_LOG_SETTER (aIndex, totemConeAudio);
109
switch (Properties (aIndex)) {
112
if (!GetInt32FromArguments (aValue, 1, 0, volume))
115
Plugin()->SetVolume ((double) CLAMP (volume, 0, 200) / 200.0);
120
if (!GetBoolFromArguments (aValue, 1, 0, mMute))
124
mSavedVolume = Plugin()->Volume();
125
Plugin()->SetVolume (0.0);
127
Plugin()->SetVolume (mSavedVolume);
134
TOTEM_WARN_SETTER_UNIMPLEMENTED (aIndex, _result);