diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | e2de64d6f1beb9e492daf5b886e19933c1fa41dd (patch) | |
tree | 9047cf9e6b5c43878d5bf82660adae77ceee097a /arts/modules/mixers | |
download | tdemultimedia-e2de64d6f1beb9e492daf5b886e19933c1fa41dd.tar.gz tdemultimedia-e2de64d6f1beb9e492daf5b886e19933c1fa41dd.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdemultimedia@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'arts/modules/mixers')
13 files changed, 717 insertions, 0 deletions
diff --git a/arts/modules/mixers/Makefile.am b/arts/modules/mixers/Makefile.am new file mode 100644 index 00000000..b504bfba --- /dev/null +++ b/arts/modules/mixers/Makefile.am @@ -0,0 +1,60 @@ + +INCLUDES = \ + -I$(top_builddir)/arts/modules \ + -I$(top_srcdir)/arts/modules \ + -I$(top_builddir)/arts/modules/common \ + -I$(top_srcdir)/arts/modules/common \ + -I$(top_builddir)/arts/modules/synth \ + -I$(top_srcdir)/arts/modules/synth \ + -I$(top_builddir)/arts/modules/effects \ + -I$(top_builddir)/arts/gui/common \ + -I$(top_srcdir)/arts/gui/common \ + -I$(top_builddir)/arts/midi \ + -I$(top_srcdir)/arts/midi \ + -I$(arts_includes) \ + $(all_includes) + +MCOPINCLUDES = \ + -I$(top_srcdir)/arts/modules \ + -I$(top_srcdir)/arts/modules/common \ + -I$(top_srcdir)/arts/modules/synth \ + -I$(top_srcdir)/arts/gui/common \ + -I$(top_srcdir)/arts/midi \ + -I$(arts_includes) \ + $(all_includes) + +lib_LTLIBRARIES = libartsmodulesmixers.la + +libartsmodulesmixers_la_SOURCES = artsmodulesmixers.cc \ + monosimplemixerchannel_impl.cc monosimplemixerchannelguifactory_impl.cc \ + simplemixerchannel_impl.cc simplemixerchannelguifactory_impl.cc \ + littlestereomixerchannel_impl.cc +libartsmodulesmixers_la_COMPILE_FIRST = ../synth/artsmodulessynth.h \ + ../../midi/artsmidi.h ../common/artsmodulescommon.h ../../gui/common/artsgui.h \ + artsmodulesmixers.h +libartsmodulesmixers_la_LIBADD = \ + $(top_builddir)/arts/gui/common/libartsgui_idl.la \ + $(top_builddir)/arts/modules/common/libartsmodulescommon.la \ + $(top_builddir)/arts/modules/effects/libartsmoduleseffects.la \ + -lartsflow -lartsflow_idl -lmcop + +libartsmodulesmixers_la_LDFLAGS = $(all_libraries) -L$(arts_libraries) -no-undefined + +artsmodulesmixers.cc artsmodulesmixers.h artsmodulesmixers.mcoptype artsmodulesmixers.mcopclass: $(srcdir)/artsmodulesmixers.idl $(MCOPIDL) + $(MCOPIDL) -t $(MCOPINCLUDES) $(srcdir)/artsmodulesmixers.idl + +DISTCLEANFILES= artsmodulesmixers.cc artsmodulesmixers.h artsmodulesmixers.mcop* + +artsincludedir = $(includedir)/arts +artsinclude_HEADERS = artsmodulesmixers.h artsmodulesmixers.idl + +mcoptypedir = $(libdir)/mcop +mcoptype_DATA = artsmodulesmixers.mcoptype artsmodulesmixers.mcopclass + +mcopclassdir = $(libdir)/mcop/Arts +mcopclass_DATA = \ + mcopclass/MonoSimpleMixerChannel.mcopclass mcopclass/MonoSimpleMixerChannelGuiFactory.mcopclass \ + mcopclass/SimpleMixerChannel.mcopclass mcopclass/SimpleMixerChannelGuiFactory.mcopclass \ + mcopclass/LittleStereoMixerChannel.mcopclass mcopclass/LittleStereoMixerChannelGuiFactory.mcopclass + +littlestereomixerchannel_impl.lo: ../effects/artsmoduleseffects.h diff --git a/arts/modules/mixers/artsmodulesmixers.idl b/arts/modules/mixers/artsmodulesmixers.idl new file mode 100644 index 00000000..f2eb6de8 --- /dev/null +++ b/arts/modules/mixers/artsmodulesmixers.idl @@ -0,0 +1,81 @@ +/* + + Copyright (C) 2000-2001 Stefan Westerfeld + stefan@space.twc.de + 2001-2003 Matthias Kretz + kretz@kde.org + 2002-2003 Arnold Krille + arnold@arnoldarts.de + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + +*/ + +/* +* DISCLAIMER: The interfaces in artsmodules.idl (and the derived .cc/.h files) +* DO NOT GUARANTEE BINARY COMPATIBILITY YET. +* +* They are intended for developers. You shouldn't expect that applications in +* binary form will be fully compatibile with further releases of these +* interfaces. +*/ + +#include <artsflow.idl> + +#include <artsmodulessynth.idl> +#include <artsmodulescommon.idl> + +module Arts { + +interface SimpleMixerChannel : Environment::MixerChannel { + readonly attribute Synth_STD_EQUALIZER equalizerLeft, equalizerRight; + readonly attribute StereoEffectStack insertEffects; + attribute float gainLeft, gainRight; + attribute float pan; + attribute float volumeLeft, volumeRight; +}; + +// creates: SimpleMixerChannel +interface SimpleMixerChannelGuiFactory : GuiFactory { +}; + +interface MonoSimpleMixerChannel : Environment::MixerChannel { + readonly attribute Synth_STD_EQUALIZER equalizer; + readonly attribute StereoEffectStack insertEffects; + attribute float gain; + attribute float pan; + attribute float volume; +}; + +// creates: MonoSimpleMixerChannel +interface MonoSimpleMixerChannelGuiFactory : GuiFactory { +}; + +interface Synth_AUX_BUS : SynthModule { + attribute float level; + attribute long channel; + in audio stream invalue; +}; + +interface LittleStereoMixerChannel : Environment::MixerChannel { + attribute float volume; + attribute float balance; +}; +interface LittleStereoMixerChannelGuiFactory : GuiFactory { +}; + +}; + diff --git a/arts/modules/mixers/littlestereomixerchannel_impl.cc b/arts/modules/mixers/littlestereomixerchannel_impl.cc new file mode 100644 index 00000000..ec521e6e --- /dev/null +++ b/arts/modules/mixers/littlestereomixerchannel_impl.cc @@ -0,0 +1,134 @@ + /* + + Copyright ( C ) 2002-2003 Arnold Krille <arnold@arnoldarts.de> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + + */ + +#include "artsmodulesmixers.h" +#include "artsmoduleseffects.h" + +#include <flowsystem.h> +#include <stdsynthmodule.h> +#include <connect.h> +#include <debug.h> +#include "artsgui.h" + +#include <klocale.h> + +using namespace Arts; + +namespace Arts { + +class LittleStereoMixerChannel_impl : virtual public LittleStereoMixerChannel_skel, + virtual public StdSynthModule +{ +protected: + std::string _name; + Arts::StereoBalance _balance; + Arts::StereoVolumeControl _volume; +public: + LittleStereoMixerChannel_impl() + { + arts_debug( "LittleStereo startup" ); + if( _balance.isNull() ) arts_debug( "\n\nCouldn't create StereoBalance!!!!\n\n" ); + if( _volume.isNull() ) arts_debug( "\n\nCouldn't create StereoVolumeControl!!!!\n\n" ); + _balance.balance( 0 ); + _volume.scaleFactor( 1 ); + arts_debug( "startup ok\n" ); + } + + std::string name() { return _name; } + void name( const std::string& n ) { arts_debug( "Name = %s", n.c_str() ); _name = n; } + + //Arts::StereoBalance balance() { return _balance; } + + //Arts::StereoVolumeControl volume() { return _volume; } + + float balance() { return _balance.balance(); } + void balance( float n ) { _balance.balance( n ); } + + float volume() { return _volume.scaleFactor(); } + void volume( float n ) { _volume.scaleFactor( n ); } + + void streamInit() + { + arts_debug( "LittleStereo::streamInit()" ); + if( _balance.isNull() ) arts_warning( "Couldn't create StereoBalance!!!!\n" ); + if( _volume.isNull() ) arts_warning( "Couldn't create StereoVolumeControl!!!!\n" ); + + arts_debug( "LittleStereo::streamInit() starts" ); + _balance.start(); + _volume.start(); + + arts_debug( "LittleStereo::streamInit() first connects" ); + _node()->virtualize( "inleft", _balance._node(), "inleft" ); + _node()->virtualize( "inright", _balance._node(), "inright" ); + arts_debug( "LittleStereo::streamInit() middle connects" ); + connect( _balance, "outleft", _volume, "inleft" ); + connect( _balance, "outright", _volume, "inright" ); + arts_debug( "LittleStereo::streamInit() last connects" ); + _node()->virtualize( "outleft", _volume._node(), "outleft" ); + _node()->virtualize( "outright", _volume._node(), "outright" ); + arts_debug( "LittleStereo::streamInit() finished.\nbye" ); + _balance.balance( 0 ); + _volume.scaleFactor( 1 ); + } + + void streamEnd() + { + _balance.stop(); + _volume.stop(); + } + +}; +REGISTER_IMPLEMENTATION( LittleStereoMixerChannel_impl ); + +class LittleStereoMixerChannelGuiFactory_impl : virtual public LittleStereoMixerChannelGuiFactory_skel +{ +public: + Widget createGui( Object object ) + { + arts_return_val_if_fail(!object.isNull(), Arts::Widget::null()); + LittleStereoMixerChannel ch= DynamicCast(object); + arts_return_val_if_fail(!ch.isNull(), Arts::Widget::null()); + + Arts::LayoutBox vbox; + vbox.direction( Arts::TopToBottom ); + + Poti pan; + pan.caption( i18n( "pan" ).utf8().data() ); + pan.color( "grey" ); pan.min( -1.0 ); pan.max( 1.0 ); + pan.value( ch.balance() ); + connect( pan, "value_changed", ch, "balance" ); + vbox.addWidget( pan ); + + Fader volume; + volume.caption( i18n( "volume" ).utf8().data() ); + volume.color( "red" ); volume.min( 0.01 ); volume.max( 2 ); + //volume.logarithmic( 2 ); + volume.value( ch.volume() ); + connect( volume, "value_changed", ch, "volume" ); + vbox.addWidget( volume ); + + return vbox; + } +}; +REGISTER_IMPLEMENTATION( LittleStereoMixerChannelGuiFactory_impl ); + +} + diff --git a/arts/modules/mixers/mcopclass/LittleStereoMixerChannel.mcopclass b/arts/modules/mixers/mcopclass/LittleStereoMixerChannel.mcopclass new file mode 100644 index 00000000..eba4b12e --- /dev/null +++ b/arts/modules/mixers/mcopclass/LittleStereoMixerChannel.mcopclass @@ -0,0 +1,4 @@ +Buildable=true +Interface=Arts::LittleStereoMixerChannel,Arts::Environment::MixerChannel,Arts::SynthModule,Arts::Object +Language=C++ +Library=libartsmodulesmixers.la diff --git a/arts/modules/mixers/mcopclass/LittleStereoMixerChannelGuiFactory.mcopclass b/arts/modules/mixers/mcopclass/LittleStereoMixerChannelGuiFactory.mcopclass new file mode 100644 index 00000000..b6024a6b --- /dev/null +++ b/arts/modules/mixers/mcopclass/LittleStereoMixerChannelGuiFactory.mcopclass @@ -0,0 +1,4 @@ +Interface=Arts::LittleStereoMixerChannelGuiFactory,Arts::GuiFactory,Arts::Object +CanCreate=Arts::LittleStereoMixerChannel +Language=C++ +Library=libartsmodulesmixers.la diff --git a/arts/modules/mixers/mcopclass/MonoSimpleMixerChannel.mcopclass b/arts/modules/mixers/mcopclass/MonoSimpleMixerChannel.mcopclass new file mode 100644 index 00000000..4ed15c42 --- /dev/null +++ b/arts/modules/mixers/mcopclass/MonoSimpleMixerChannel.mcopclass @@ -0,0 +1,3 @@ +Interface=Arts::MonoSimpleMixerChannel,Arts::Environment::MixerChannel,Arts::SynthModule,Arts::Object +Language=C++ +Library=libartsmodulesmixers.la diff --git a/arts/modules/mixers/mcopclass/MonoSimpleMixerChannelGuiFactory.mcopclass b/arts/modules/mixers/mcopclass/MonoSimpleMixerChannelGuiFactory.mcopclass new file mode 100644 index 00000000..41c2b719 --- /dev/null +++ b/arts/modules/mixers/mcopclass/MonoSimpleMixerChannelGuiFactory.mcopclass @@ -0,0 +1,4 @@ +Interface=Arts::MonoSimpleMixerChannelGuiFactory,Arts::GuiFactory,Arts::Object +CanCreate=Arts::MonoSimpleMixerChannel +Language=C++ +Library=libartsmodulesmixers.la diff --git a/arts/modules/mixers/mcopclass/SimpleMixerChannel.mcopclass b/arts/modules/mixers/mcopclass/SimpleMixerChannel.mcopclass new file mode 100644 index 00000000..4b8dbb87 --- /dev/null +++ b/arts/modules/mixers/mcopclass/SimpleMixerChannel.mcopclass @@ -0,0 +1,3 @@ +Interface=Arts::SimpleMixerChannel,Arts::Environment::MixerChannel,Arts::SynthModule,Arts::Object +Language=C++ +Library=libartsmodulesmixers.la diff --git a/arts/modules/mixers/mcopclass/SimpleMixerChannelGuiFactory.mcopclass b/arts/modules/mixers/mcopclass/SimpleMixerChannelGuiFactory.mcopclass new file mode 100644 index 00000000..f4b38c3e --- /dev/null +++ b/arts/modules/mixers/mcopclass/SimpleMixerChannelGuiFactory.mcopclass @@ -0,0 +1,4 @@ +Interface=Arts::SimpleMixerChannelGuiFactory,Arts::GuiFactory,Arts::Object +CanCreate=Arts::SimpleMixerChannel +Language=C++ +Library=libartsmodulesmixers.la diff --git a/arts/modules/mixers/monosimplemixerchannel_impl.cc b/arts/modules/mixers/monosimplemixerchannel_impl.cc new file mode 100644 index 00000000..04bad0ce --- /dev/null +++ b/arts/modules/mixers/monosimplemixerchannel_impl.cc @@ -0,0 +1,106 @@ +#include "artsmodulesmixers.h" +#include "flowsystem.h" +#include "stdsynthmodule.h" +#include "connect.h" + +namespace Arts { +class MonoSimpleMixerChannel_impl : virtual public MonoSimpleMixerChannel_skel, + virtual public StdSynthModule +{ +protected: + Synth_STD_EQUALIZER _equalizer; + StereoEffectStack _insertEffects; + Synth_MUL mulGain; + Synth_MUL mulVolumeLeft, mulVolumeRight; + float _gain, _pan, _volume, pLeft, pRight; + std::string _name; +public: + MonoSimpleMixerChannel_impl() + : _gain(1.0), _pan(0), _volume(1.0), pLeft(1), pRight(1) + { + setValue(mulVolumeLeft,"invalue2",_volume*pLeft); + setValue(mulVolumeRight,"invalue2",_volume*pRight); + setValue(mulGain,"invalue2",_gain); + } + + Synth_STD_EQUALIZER equalizer() { return _equalizer; } + StereoEffectStack insertEffects() { return _insertEffects; } + + float gain() { return _gain; } + void gain(float g) + { + if(g != _gain) { + _gain = g; + setValue(mulGain,"invalue2",g); + gain_changed(g); + } + } + + float volume() { return _volume; } + void volume(float v) + { + if(v != _volume) { + _volume = v; + setValue(mulVolumeLeft,"invalue2",v*pLeft); + setValue(mulVolumeRight,"invalue2",v*pRight); + volume_changed(v); + } + } + + float pan() { return _pan; } + void pan(float p) + { + if(p != _pan) + { + _pan = p; + pLeft = 1.0; + pRight = 1.0; + if(p > 0) + pLeft = 1-p; + else + pRight = 1+p; + setValue(mulVolumeLeft,"invalue2",_volume*pLeft); + setValue(mulVolumeRight,"invalue2",_volume*pRight); + pan_changed(p); + } + } + + std::string name() { return _name; } + void name(const std::string& newName) + { + if(_name != newName) { + _name = newName; + name_changed(newName); + } + } + + void streamInit() + { + _equalizer.start(); + mulVolumeLeft.start(); + mulVolumeRight.start(); + mulGain.start(); + //_insertEffects.start(); + + _node()->virtualize("inleft",mulGain._node(),"invalue1"); + connect(mulGain,"outvalue",_equalizer,"invalue"); + //connect(_equalizer,"outvalue",_insertEffects,"inleft"); + //connect(_insertEffects,"outleft",mulVolume,"invalue1"); + connect(_equalizer,"outvalue",mulVolumeLeft,"invalue1"); + connect(_equalizer,"outvalue",mulVolumeRight,"invalue1"); + _node()->virtualize("outleft",mulVolumeLeft._node(),"outvalue"); + _node()->virtualize("outright",mulVolumeRight._node(),"outvalue"); + + } + void streamEnd() + { + _equalizer.stop(); + //_insertEffects.stop(); + mulVolumeLeft.stop(); + mulVolumeRight.stop(); + mulGain.stop(); + } +}; +REGISTER_IMPLEMENTATION(MonoSimpleMixerChannel_impl); +} + diff --git a/arts/modules/mixers/monosimplemixerchannelguifactory_impl.cc b/arts/modules/mixers/monosimplemixerchannelguifactory_impl.cc new file mode 100644 index 00000000..d97f1aa4 --- /dev/null +++ b/arts/modules/mixers/monosimplemixerchannelguifactory_impl.cc @@ -0,0 +1,96 @@ +#include "artsmodulesmixers.h" +#include "debug.h" +#include "connect.h" + +#include <kglobal.h> +#include <klocale.h> + +namespace Arts { + + class MonoSimpleMixerChannelGuiFactory_impl : virtual public MonoSimpleMixerChannelGuiFactory_skel + { + public: + Widget createGui(Object object) + { + KGlobal::locale()->insertCatalogue( "artsmodules" ); + arts_return_val_if_fail(!object.isNull(), Arts::Widget::null()); + MonoSimpleMixerChannel ch= DynamicCast(object); + arts_return_val_if_fail(!ch.isNull(), Arts::Widget::null()); + + Arts::LayoutBox vbox; + vbox.direction( Arts::TopToBottom ); + + Poti gain; + gain.caption(i18n("gain").utf8().data()); + gain.color("red"); gain.min(0.01); gain.max(4); + gain.value(ch.gain()); + connect(gain,"value_changed", ch, "gain"); + vbox.addWidget( gain ); + + Arts::PopupBox eqbox; + eqbox.name( i18n( "EQ" ).utf8().data() ); + eqbox.direction( Arts::TopToBottom ); + vbox.addWidget( eqbox ); + + Arts::LayoutBox eq; + eq.direction( Arts::TopToBottom ); + eqbox.widget( eq ); + + Poti high; + high.caption(i18n("volume","high").utf8().data()); + high.color("blue"); high.min(-12); high.max(12); + high.value(ch.equalizer().high()); + connect(high,"value_changed", ch.equalizer(), "high"); + eq.addWidget( high ); + + Poti mid; + mid.caption(i18n("volume","mid").utf8().data()); + mid.color("blue"); mid.min(-12); mid.max(12); + mid.value(ch.equalizer().mid()); + connect(mid,"value_changed", ch.equalizer(), "mid"); + eq.addWidget( mid ); + + Poti low; + low.caption(i18n("volume","low").utf8().data()); + low.color("blue"); low.min(-12); low.max(12); + low.value(ch.equalizer().low()); + connect(low,"value_changed", ch.equalizer(), "low"); + eq.addWidget( low ); + + Poti frequency; + frequency.caption(i18n("frequency").utf8().data()); + frequency.color("darkgreen"); frequency.min(20); frequency.max(10000); + frequency.value(ch.equalizer().frequency()); + frequency.logarithmic(2.0); + connect(frequency,"value_changed", ch.equalizer(), "frequency"); + eq.addWidget( frequency ); + + Poti q; + q.caption(i18n( "q" ).utf8().data()); + q.color("darkgreen"); q.min(0.01); q.max(10); + q.value(ch.equalizer().q()); + q.logarithmic(2.0); + connect(q,"value_changed", ch.equalizer(), "q"); + eq.addWidget( q ); + + Poti pan; + pan.caption(i18n("pan").utf8().data()); + pan.color("grey"); pan.min(-1.0); pan.max(1.0); + pan.value(ch.pan()); + connect(pan,"value_changed",ch,"pan"); + vbox.addWidget( pan ); + + Fader volume; + volume.caption(i18n("volume").utf8().data()); + volume.color("red"); volume.min(0.01); volume.max(4); + volume.value(ch.volume()); + connect(volume,"value_changed", ch, "volume"); + vbox.addWidget( volume ); + + return vbox; + } + }; + REGISTER_IMPLEMENTATION(MonoSimpleMixerChannelGuiFactory_impl); +} + +// vim:ts=4:sw=4 diff --git a/arts/modules/mixers/simplemixerchannel_impl.cc b/arts/modules/mixers/simplemixerchannel_impl.cc new file mode 100644 index 00000000..0c00768a --- /dev/null +++ b/arts/modules/mixers/simplemixerchannel_impl.cc @@ -0,0 +1,132 @@ +#include "artsmodulesmixers.h" +#include "flowsystem.h" +#include "stdsynthmodule.h" +#include "connect.h" + +namespace Arts { +class SimpleMixerChannel_impl : virtual public SimpleMixerChannel_skel, + virtual public StdSynthModule +{ +protected: + Synth_STD_EQUALIZER _equalizerLeft, _equalizerRight; + StereoEffectStack _insertEffects; + Synth_MUL mulGainLeft, mulGainRight; + Synth_MUL mulVolumeLeft, mulVolumeRight; + float _gainLeft, _gainRight, _pan, _volumeLeft, _volumeRight, pLeft, pRight; + std::string _name; +public: + SimpleMixerChannel_impl() + : _gainLeft(1.0), _gainRight(1.0), _pan(0), _volumeLeft(1.0), _volumeRight(1.0), pLeft(1), pRight(1) + { + setValue(mulVolumeLeft,"invalue2",_volumeLeft*pLeft); + setValue(mulVolumeRight,"invalue2",_volumeRight*pRight); + setValue(mulGainLeft,"invalue2",_gainLeft); + setValue(mulGainRight,"invalue2",_gainRight); + } + + Synth_STD_EQUALIZER equalizerLeft() { return _equalizerLeft; } + Synth_STD_EQUALIZER equalizerRight() { return _equalizerRight; } + StereoEffectStack insertEffects() { return _insertEffects; } + + float gainLeft() { return _gainLeft; } + void gainLeft(float g) + { + if(g != _gainLeft) { + _gainLeft = g; + setValue(mulGainLeft,"invalue2",g); + gainLeft_changed(g); + } + } + + float gainRight() { return _gainRight; } + void gainRight(float g) + { + if(g != _gainRight) { + _gainRight = g; + setValue(mulGainRight,"invalue2",g); + gainRight_changed(g); + } + } + + float volumeLeft() { return _volumeLeft; } + void volumeLeft(float v) + { + if(v != _volumeLeft) { + _volumeLeft = v; + setValue(mulVolumeLeft,"invalue2",v*pLeft); + volumeLeft_changed(v); + } + } + + float volumeRight() { return _volumeRight; } + void volumeRight(float v) + { + if(v != _volumeRight) { + _volumeRight = v; + setValue(mulVolumeRight,"invalue2",v*pRight); + volumeRight_changed(v); + } + } + + float pan() { return _pan; } + void pan(float p) + { + if(p != _pan) + { + _pan = p; + pLeft = 1.0; + pRight = 1.0; + if(p > 0) + pLeft = 1-p; + else + pRight = 1+p; + setValue(mulVolumeLeft,"invalue2",_volumeLeft*pLeft); + setValue(mulVolumeRight,"invalue2",_volumeRight*pRight); + pan_changed(p); + } + } + + std::string name() { return _name; } + void name(const std::string& newName) + { + if(_name != newName) { + _name = newName; + name_changed(newName); + } + } + + void streamInit() + { + _equalizerLeft.start(); + _equalizerRight.start(); + _insertEffects.start(); + mulVolumeLeft.start(); + mulVolumeRight.start(); + mulGainLeft.start(); + mulGainRight.start(); + + _node()->virtualize("inleft",mulGainLeft._node(),"invalue1"); + _node()->virtualize("inright",mulGainRight._node(),"invalue1"); + connect(mulGainLeft,"outvalue",_equalizerLeft,"invalue"); + connect(mulGainRight,"outvalue",_equalizerRight,"invalue"); + connect(_equalizerLeft,"outvalue",_insertEffects,"inleft"); + connect(_equalizerRight,"outvalue",_insertEffects,"inright"); + connect(_insertEffects,"outleft",mulVolumeLeft,"invalue1"); + connect(_insertEffects,"outright",mulVolumeRight,"invalue1"); + _node()->virtualize("outleft",mulVolumeLeft._node(),"outvalue"); + _node()->virtualize("outright",mulVolumeRight._node(),"outvalue"); + } + void streamEnd() + { + _equalizerLeft.stop(); + _equalizerRight.stop(); + _insertEffects.stop(); + mulVolumeLeft.stop(); + mulVolumeRight.stop(); + mulGainLeft.stop(); + mulGainRight.stop(); + } +}; +REGISTER_IMPLEMENTATION(SimpleMixerChannel_impl); +} + diff --git a/arts/modules/mixers/simplemixerchannelguifactory_impl.cc b/arts/modules/mixers/simplemixerchannelguifactory_impl.cc new file mode 100644 index 00000000..0f585eb1 --- /dev/null +++ b/arts/modules/mixers/simplemixerchannelguifactory_impl.cc @@ -0,0 +1,86 @@ +#include "artsmodulesmixers.h" +#include "debug.h" +#include "connect.h" + +#include <kglobal.h> +#include <klocale.h> + +namespace Arts { + class SimpleMixerChannelGuiFactory_impl : virtual public SimpleMixerChannelGuiFactory_skel { + public: + Widget createGui(Object object) + { + KGlobal::locale()->insertCatalogue( "artsmodules" ); + arts_return_val_if_fail(!object.isNull(), Arts::Widget::null()); + SimpleMixerChannel ch = DynamicCast(object); + arts_return_val_if_fail(!ch.isNull(), Arts::Widget::null()); + + Arts::LayoutBox vbox; + vbox.direction( Arts::TopToBottom ); + + Poti high; + high.caption(i18n("volume","high").utf8().data()); + high.color("blue"); high.min(-12); high.max(12); + high.value(ch.equalizerLeft().high()); + connect(high,"value_changed", ch.equalizerLeft(), "high"); + connect(high,"value_changed", ch.equalizerRight(), "high"); + vbox.addWidget( high ); + + Poti mid; + mid.caption(i18n("volume","mid").utf8().data()); + mid.color("blue"); mid.min(-12); mid.max(12); + mid.value(ch.equalizerLeft().mid()); + connect(mid,"value_changed", ch.equalizerLeft(), "mid"); + connect(mid,"value_changed", ch.equalizerRight(), "mid"); + vbox.addWidget( mid ); + + Poti low; + low.caption(i18n("volume","low").utf8().data()); + low.color("blue"); low.min(-12); low.max(12); + low.value(ch.equalizerLeft().low()); + connect(low,"value_changed", ch.equalizerLeft(), "low"); + connect(low,"value_changed", ch.equalizerRight(), "low"); + vbox.addWidget( low ); + + Poti frequency; + frequency.caption(i18n("frequency").utf8().data()); + frequency.color("darkgreen"); frequency.min(200); frequency.max(10000); + frequency.value(ch.equalizerLeft().frequency()); + frequency.logarithmic(2.0); + connect(frequency,"value_changed", ch.equalizerLeft(), "frequency"); + connect(frequency,"value_changed", ch.equalizerRight(), "frequency"); + vbox.addWidget( frequency ); + + Poti q; + q.caption(i18n( "q" ).utf8().data()); + q.color("darkgreen"); q.min(0.01); q.max(10); + q.value(ch.equalizerLeft().q()); + q.logarithmic(2.0); + connect(q,"value_changed", ch.equalizerLeft(), "q"); + connect(q,"value_changed", ch.equalizerRight(), "q"); + vbox.addWidget( q ); + + Poti pan; + pan.caption(i18n("pan").utf8().data()); + pan.color("grey"); pan.min(-1.0); pan.max(1.0); + pan.value(ch.pan()); + connect(pan,"value_changed",ch,"pan"); + vbox.addWidget( pan ); + + Fader volume; + volume.caption(i18n("volume").utf8().data()); + volume.color("red"); volume.min(0.01); volume.max(4); + volume.value(ch.volumeLeft()); + connect(volume,"value_changed", ch, "volumeLeft"); + connect(volume,"value_changed", ch, "volumeRight"); + vbox.addWidget( volume ); + + return vbox; + } + }; + REGISTER_IMPLEMENTATION(SimpleMixerChannelGuiFactory_impl); +} + + +// vim:ts=4:sw=4 + |