Index: NetworkEditor/example-data/Harmonizer.clamnetwork.pos
===================================================================
No se puede mostrar: el archivo está marcado como binario.
svn:mime-type = application/octet-stream
Index: NetworkEditor/example-data/harmonizer.ui
===================================================================
--- NetworkEditor/example-data/harmonizer.ui (revisión: 0)
+++ NetworkEditor/example-data/harmonizer.ui (revisión: 0)
@@ -0,0 +1,415 @@
+
+ Dialog
+
+
+
+ 0
+ 0
+ 680
+ 577
+
+
+
+ Vocal Harmonizer
+
+
+
+ 9
+
+
+ 6
+
+ -
+
+
+ 0
+
+
+ 6
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+ QSizePolicy::Minimum
+
+
+
+ 20
+ 20
+
+
+
+
+ -
+
+
+
+ 5
+ 1
+ 0
+ 0
+
+
+
+ Input Voice
+
+
+
+ -
+
+
+
+ 7
+ 5
+ 0
+ 0
+
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+ QSizePolicy::Maximum
+
+
+
+ 20
+ 20
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+ 0
+
+
+ 6
+
+
-
+
+
+ 0
+
+
+ 8
+
+
-
+
+
+ Voice 4 (Pitch)
+
+
+
+ -
+
+
+ Voice 1 (PItch)
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+ Gain 1
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+
+ 5
+ 1
+ 0
+ 0
+
+
+
+ Gain 3
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+ Voice 3 (Pitch)
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+ Gain 2
+
+
+
+ -
+
+
+ Voice 2
+
+
+
+ -
+
+
+ Voice 2 (Pitch)
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+ QSizePolicy::Maximum
+
+
+
+ 20
+ 40
+
+
+
+
+ -
+
+
+
+ 7
+ 7
+ 0
+ 0
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+ QSizePolicy::Fixed
+
+
+
+ 20
+ 20
+
+
+
+
+ -
+
+
+ 0
+
+
+ 6
+
+
-
+
+
+
+ 7
+ 0
+ 0
+ 0
+
+
+
+ Play
+
+
+
+ -
+
+
+
+ 7
+ 0
+ 0
+ 0
+
+
+
+ Stop
+
+
+
+ -
+
+
+ 0
+
+
+ 6
+
+
-
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ Playback
+
+
+
+ -
+
+
+ Backend
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+
+
+ -
+
+
+
+ 7
+ 5
+ 0
+ 0
+
+
+
+ Close
+
+
+
+
+
+
+
+
+
+ Oscilloscope
+ QWidget
+
+
+
+
+
+
+ CloseButton
+ clicked()
+ Dialog
+ accept()
+
+
+ 593
+ 509
+
+
+ 484
+ 516
+
+
+
+
+
Index: NetworkEditor/example-data/spectralNetwork.clamnetwork.pos
===================================================================
No se puede mostrar: el archivo está marcado como binario.
svn:mime-type = application/octet-stream
Index: NetworkEditor/src/NetworkCanvas.hxx
===================================================================
--- NetworkEditor/src/NetworkCanvas.hxx (revisión: 10372)
+++ NetworkEditor/src/NetworkCanvas.hxx (copia de trabajo)
@@ -443,7 +443,7 @@
unsigned controlIndex = processing->controlIndexByXPos(point);
QString inControlName = processing->getIncontrolName(controlIndex);
- float default_value = processing->getIncontrolDefault(controlIndex);
+ float default_value = processing->getIncontrolDefaultValue(controlIndex);
float lower = processing->getIncontrolLowerBound(controlIndex);
float upper = processing->getIncontrolUpperBound(controlIndex);
Index: NetworkEditor/src/RegisterConfiguratorLaunchers_SMS.cxx
===================================================================
--- NetworkEditor/src/RegisterConfiguratorLaunchers_SMS.cxx (revisión: 10372)
+++ NetworkEditor/src/RegisterConfiguratorLaunchers_SMS.cxx (copia de trabajo)
@@ -29,6 +29,9 @@
#include
#include
#include
+#include
+// #include "SMSHarmonizer.hxx"
+// #include "RegisterConfiguratorLaunchers.hxx"
STANDARD_PROCESSING_CONFIG_REGISTER(SMSAnalysisConfig);
STANDARD_PROCESSING_CONFIG_REGISTER(SMSSynthesisConfig);
STANDARD_PROCESSING_CONFIG_REGISTER(SpectralPeakDetectConfig);
@@ -37,7 +40,11 @@
STANDARD_PROCESSING_CONFIG_REGISTER(PhaseManagementConfig);
STANDARD_PROCESSING_CONFIG_REGISTER(SinTrackingConfig);
STANDARD_PROCESSING_CONFIG_REGISTER(SynthSineSpectrumConfig);
+// STANDARD_PROCESSING_CONFIG_REGISTER(SMSHarmonizer::Config);
+STANDARD_PROCESSING_CONFIG_REGISTER(SMSHarmonizerConfig);
+
+
//SDIF
#include
STANDARD_PROCESSING_CONFIG_REGISTER(SDIFInConfig);
Index: NetworkEditor/src/ProcessingBox.cxx
===================================================================
--- NetworkEditor/src/ProcessingBox.cxx (revisión: 10372)
+++ NetworkEditor/src/ProcessingBox.cxx (copia de trabajo)
@@ -639,7 +639,7 @@
QString name = inControl.GetName().c_str();
return name;
}
-float ProcessingBox::getIncontrolDefault(unsigned index) const
+float ProcessingBox::getIncontrolDefaultValue(unsigned index) const
{
CLAM::InControl& inControl = _processing->GetInControls().GetByNumber(index);
return inControl.DefaultValue();
Index: NetworkEditor/src/ProcessingBox.hxx
===================================================================
--- NetworkEditor/src/ProcessingBox.hxx (revisión: 10372)
+++ NetworkEditor/src/ProcessingBox.hxx (copia de trabajo)
@@ -72,7 +72,7 @@
QString getIncontrolNameAndBounds(unsigned i) const;
float getIncontrolUpperBound(unsigned index) const;
float getIncontrolLowerBound(unsigned index) const;
- float getIncontrolDefault(unsigned index) const;
+ float getIncontrolDefaultValue(unsigned index) const;
QString getIncontrolName(unsigned i) const;
QString getOutcontrolName(unsigned i) const;
/// Get the connector prototyper name at the given parent pos
Index: CLAM/test/UnitTests/ControlsTests/ControlsTest.cxx
===================================================================
--- CLAM/test/UnitTests/ControlsTests/ControlsTest.cxx (revisión: 10372)
+++ CLAM/test/UnitTests/ControlsTests/ControlsTest.cxx (copia de trabajo)
@@ -95,6 +95,9 @@
CPPUNIT_TEST( testInControl_settingBounds );
CPPUNIT_TEST( testInControl_boundedDefaultValue );
CPPUNIT_TEST( testInControl_isBoundedWhenTrue );
+
+ // Testing default value
+ CPPUNIT_TEST( testInControl_setDefaultprevailstoBounds );
CPPUNIT_TEST_SUITE_END();
@@ -460,6 +463,14 @@
inControl.SetBounds(0.f, 0.f);
CPPUNIT_ASSERT_EQUAL( true, inControl.IsBounded() );
}
+
+ void testInControl_setDefaultprevailstoBounds()
+ {
+ CLAM::InControl inControl("inControl");
+ inControl.SetBounds(0.f, 10.f);
+ inControl.SetDefaultValue(0.0f);
+ CPPUNIT_ASSERT_EQUAL( 0.0f, inControl.DefaultValue() );
+ }
};
Index: CLAM/src/Flow/Controls/InControl.cxx
===================================================================
--- CLAM/src/Flow/Controls/InControl.cxx (revisión: 10372)
+++ CLAM/src/Flow/Controls/InControl.cxx (copia de trabajo)
@@ -59,10 +59,6 @@
{
return mBounded;
}
-bool InControl::HasDefaultValue() const
-{
- return mHasDefaultValue;
-}
TControlData InControl::UpperBound() const
{
return mUpperBound;
@@ -85,7 +81,6 @@
TControlData InControl::DefaultValue() const
{
if (mHasDefaultValue) return mDefaultValue;
- if (!mBounded) return 0;
return (mUpperBound+mLowerBound)/2.f;
}
Index: CLAM/src/Flow/Controls/InControl.hxx
===================================================================
--- CLAM/src/Flow/Controls/InControl.hxx (revisión: 10372)
+++ CLAM/src/Flow/Controls/InControl.hxx (copia de trabajo)
@@ -65,10 +65,9 @@
bool IsConnectedTo( OutControl & );
bool IsConnected() const;
bool IsBounded() const;
- bool HasDefaultValue() const;
TControlData UpperBound() const;
TControlData LowerBound() const;
- /** Returns default value if exists. If don't and bounds were set, returns the mean between them or 0 as general default */
+ /** Returns the bounds mean or the value set with SetDefaultValue() if its the case */
TControlData DefaultValue() const;
void SetDefaultValue(TControlData val);
void SetBounds(TControlData lower, TControlData upper);
Index: CLAM/src/Processing/Transformations/SMS/SMSHarmonizer.cxx
===================================================================
--- CLAM/src/Processing/Transformations/SMS/SMSHarmonizer.cxx (revisión: 10372)
+++ CLAM/src/Processing/Transformations/SMS/SMSHarmonizer.cxx (copia de trabajo)
@@ -61,7 +61,8 @@
if (gain<0.01) //means voice OFF
continue;
- TData amount = mVoicesPitch[i].GetLastValue();
+// TData amount = mVoicesPitch[i].GetLastValue();
+ TData amount = pow( 2., mVoicesPitch[i].GetLastValue()/12. ); //adjust to tempered scale half-tones
mPitchShift.GetInControl("PitchSteps").DoControl(amount);
mPitchShift.Do( inPeaks,
inFund,
@@ -92,4 +93,36 @@
);
}
+bool SMSHarmonizer::ConcreteConfigure(const ProcessingConfig& config)
+ {
+ CopyAsConcreteConfig( mConfig, config );
+
+// if (SomeWeirdConditionHappens)
+// {
+// AddConfigErrorMessage("Some weird condition");
+// return false;
+// }
+
+ mPitchShift.Configure( FrameTransformationConfig() );
+
+ mIgnoreResidualCtl.SetBounds(0,1);
+ //By default we ignore residual!!
+ mIgnoreResidualCtl.SetDefaultValue(1);
+ mIgnoreResidualCtl.DoControl(1);
+
+ mVoice0Gain.SetBounds(-2.,2.);
+ mVoice0Gain.SetDefaultValue(1.);
+ mVoice0Gain.DoControl(1.);
+
+ for (int i=0; i < mVoicesPitch.Size(); i++)
+ {
+ mVoicesPitch[i].SetBounds(-24.,24.);
+ mVoicesPitch[i].SetDefaultValue(0.); //no pitch shift
+ mVoicesPitch[i].DoControl(0.);
+ mVoicesGain[i].SetBounds(-2.,2.);
+ mVoicesGain[i].DoControl(0.);
+ }
+
+ return true;
+ }
}
Index: CLAM/src/Processing/Transformations/SMS/SMSHarmonizer.hxx
===================================================================
--- CLAM/src/Processing/Transformations/SMS/SMSHarmonizer.hxx (revisión: 10372)
+++ CLAM/src/Processing/Transformations/SMS/SMSHarmonizer.hxx (copia de trabajo)
@@ -33,12 +33,13 @@
#include "SMSPitchShift.hxx"
#include "SpectrumAdder2.hxx"
#include "SMSSinusoidalGain.hxx"
+#include "SMSHarmonizerConfig.hxx"
-
namespace CLAM{
class SMSHarmonizer: public FrameTransformation
{
+
/** This method returns the name of the object
* @return Char pointer with the name of object
*/
@@ -81,36 +82,11 @@
mVoicesPitch(VOICES_AMOUNT, "Pitch", this),
mVoicesGain(VOICES_AMOUNT, "Gain", this)
{
- Configure( FrameTransformationConfig() );
+ Configure( mConfig );
}
~SMSHarmonizer() {}
-
- bool ConcreteConfigure(const ProcessingConfig& c)
- {
- mPitchShift.Configure( FrameTransformationConfig() );
- mIgnoreResidualCtl.SetBounds(0,1);
- //By default we ignore residual!!
- mIgnoreResidualCtl.SetDefaultValue(1);
- mIgnoreResidualCtl.DoControl(1);
-
- mVoice0Gain.SetBounds(-2.,2.);
- mVoice0Gain.SetDefaultValue(1.);
- mVoice0Gain.DoControl(1.);
-
- for (int i=0; i < mVoicesPitch.Size(); i++)
- {
- mVoicesPitch[i].SetBounds(-3.,3.);
- mVoicesPitch[i].SetDefaultValue(1.); //no pitch shift
- mVoicesPitch[i].DoControl(0.);
- mVoicesGain[i].SetBounds(-2.,2.);
- mVoicesGain[i].DoControl(0.);
- }
-
- return true;
- }
-
bool Do()
{
bool result = Do(mInPeaks.GetData(),
@@ -146,20 +122,18 @@
return mPitchShift.mIgnoreResidual.DoControl(value);
}
-// FIXME
- // Configuration data
-// DYN_ATTRIBUTE(0,protected,int,prSamplingRate);
-// DYNAMIC_TYPE_USING_INTERFACE( SimpleConfig, 1, ProcessingConfig );
-// DYN_ATTRIBUTE( 0, public, int, FrameSize);
-// protected:
-// void DefaultInit()
-// {
-// AddAll();
-// UpdateData();
-// SetFrameSize(512);
-// };
+ typedef SMSHarmonizerConfig Config;
+ const ProcessingConfig & GetConfig() const
+ {
+ return mConfig;
+ }
+
+ protected:
+ bool ConcreteConfigure(const ProcessingConfig& config);
+
private:
+ Config mConfig;
SMSPitchShift mPitchShift;
SpectrumAdder2 mSpectrumAdder;
Index: CLAM/src/Processing/Transformations/SMS/SMSHarmonizerConfig.cxx
===================================================================
--- CLAM/src/Processing/Transformations/SMS/SMSHarmonizerConfig.cxx (revisión: 0)
+++ CLAM/src/Processing/Transformations/SMS/SMSHarmonizerConfig.cxx (revisión: 0)
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2004 MUSIC TECHNOLOGY GROUP (MTG)
+ * UNIVERSITAT POMPEU FABRA
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include "SMSHarmonizerConfig.hxx"
+
+namespace CLAM
+{
+ void SMSHarmonizerConfig::DefaultInit( )
+ {
+ AddAll();
+ UpdateData();
+// SetVoicesSize(4);
+ }
+
+ void SMSHarmonizerConfig::DefaultValues( )
+ {
+ }
+}
+
Index: CLAM/src/Processing/Transformations/SMS/SMSHarmonizerConfig.hxx
===================================================================
--- CLAM/src/Processing/Transformations/SMS/SMSHarmonizerConfig.hxx (revisión: 0)
+++ CLAM/src/Processing/Transformations/SMS/SMSHarmonizerConfig.hxx (revisión: 0)
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2004 MUSIC TECHNOLOGY GROUP (MTG)
+ * UNIVERSITAT POMPEU FABRA
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __SMSHarmonizerConfig__
+#define __SMSHarmonizerConfig__
+
+#include "ProcessingConfig.hxx"
+
+namespace CLAM {
+
+/**
+* The Harmonizer configuration object.
+*/
+class SMSHarmonizerConfig : public ProcessingConfig
+{
+public:
+ DYNAMIC_TYPE_USING_INTERFACE( SMSHarmonizerConfig, 2, ProcessingConfig );
+ DYN_ATTRIBUTE (0, public, bool, IgnoreResidual);
+ DYN_ATTRIBUTE( 1, public, int, VoicesSize ); // FIXME TSize
+
+public:
+// void SetVoicesSize(TSize f);
+// TSize GetVoicesSize();
+// void SetIgnoreResidual(bool value);
+
+ void DefaultValues();
+
+protected:
+ void DefaultInit();
+};
+
+} // namespace CLAM
+
+#endif
+