This GitLab instance reached the end of its service life. It won't be possible to create new users or projects.

Please read the deprecation notice for more information concerning the deprecation timeline

Visit migration.git.tu-berlin.de (internal network only) to import your old projects to the new GitLab platform 📥

Commit a68855f5 by Henrik von Coler

Fixing!

parents a9034df2 6fd0ac64
port: 6666 port: 6666
path: "/shift" path1: "/shift"
dummy: "lsrg" path2: "/gain"
...@@ -83,6 +83,7 @@ int AmExample::process(jack_nframes_t nframes) ...@@ -83,6 +83,7 @@ int AmExample::process(jack_nframes_t nframes)
// get the recent carrier frequency // get the recent carrier frequency
// value from the OSC manager // value from the OSC manager
double tmpGain = oscman->get_gain();
double shift = oscman->get_shift(); double shift = oscman->get_shift();
// set sinusoid parameter // set sinusoid parameter
...@@ -106,7 +107,11 @@ int AmExample::process(jack_nframes_t nframes) ...@@ -106,7 +107,11 @@ int AmExample::process(jack_nframes_t nframes)
for(int chanCNT=0; chanCNT<nChannels; chanCNT++) for(int chanCNT=0; chanCNT<nChannels; chanCNT++)
{ {
// apply AM // apply AM
<<<<<<< HEAD
out[chanCNT][sampCNT] = in[chanCNT][sampCNT] * (1+tmpVal)/2 ; out[chanCNT][sampCNT] = in[chanCNT][sampCNT] * (1+tmpVal)/2 ;
=======
out[chanCNT][sampCNT] = in[chanCNT][sampCNT] * tmpVal * tmpGain ;
>>>>>>> 6fd0ac641f2bb188bc15042bdf49ace73ca6544e
} }
} }
......
...@@ -21,6 +21,7 @@ OscMan::OscMan(YamlMan *yaml_manager) ...@@ -21,6 +21,7 @@ OscMan::OscMan(YamlMan *yaml_manager)
cout << "Receiving OSC on port: " << port << std::endl; cout << "Receiving OSC on port: " << port << std::endl;
shift = 1.0;
gain = 1.0; gain = 1.0;
try try
...@@ -33,7 +34,11 @@ OscMan::OscMan(YamlMan *yaml_manager) ...@@ -33,7 +34,11 @@ OscMan::OscMan(YamlMan *yaml_manager)
} }
// Add the example handler to the server! // Add the example handler to the server!
st->add_method(yaml_manager->return_path(), "f", gain_callback, this); st->add_method(yaml_manager->return_path_1(), "f", shift_callback, this);
// Add the example handler to the server!
st->add_method(yaml_manager->return_path_2(), "f", gain_callback, this);
st->start(); st->start();
...@@ -41,6 +46,20 @@ OscMan::OscMan(YamlMan *yaml_manager) ...@@ -41,6 +46,20 @@ OscMan::OscMan(YamlMan *yaml_manager)
} }
int OscMan::shift_callback(const char *path, const char *types, lo_arg ** argv,
int argc, void *data, void *user_data )
{
// Do a static cast
OscMan* statCast = static_cast<OscMan*>(user_data);
std::cout << "Changed shift to: " << argv[0]->f << std::endl;
statCast->shift = argv[0]->f;
}
int OscMan::gain_callback(const char *path, const char *types, lo_arg ** argv, int OscMan::gain_callback(const char *path, const char *types, lo_arg ** argv,
int argc, void *data, void *user_data ) int argc, void *data, void *user_data )
{ {
...@@ -49,14 +68,18 @@ int argc, void *data, void *user_data ) ...@@ -49,14 +68,18 @@ int argc, void *data, void *user_data )
// Do a static cast // Do a static cast
OscMan* statCast = static_cast<OscMan*>(user_data); OscMan* statCast = static_cast<OscMan*>(user_data);
std::cout << "Changed volume to: " << argv[0]->f << std::endl; std::cout << "Changed gain to: " << argv[0]->f << std::endl;
statCast->gain = argv[0]->f; statCast->gain = argv[0]->f;
} }
double OscMan::get_shift() double OscMan::get_shift()
{ {
return shift;
}
double OscMan::get_gain()
{
return gain; return gain;
} }
...@@ -39,10 +39,24 @@ private: ...@@ -39,10 +39,24 @@ private:
/// ///
lo::ServerThread *st; lo::ServerThread *st;
/// The actual gain value /// The actual shift value
double shift;
/// The master gain value
double gain; double gain;
/// ///
////// \brief OscMan::shift_callback
////// \param path
////// \param types
////// \param argv
////// \param argc
////// \param data
////// \param user_data
////// \return
static int shift_callback(const char *path, const char *types, lo_arg ** argv,
int argc, void *data, void *user_data);
///
////// \brief OscMan::gain_callback ////// \brief OscMan::gain_callback
////// \param path ////// \param path
////// \param types ////// \param types
...@@ -66,11 +80,17 @@ public: ...@@ -66,11 +80,17 @@ public:
OscMan(YamlMan *yaml_manager); OscMan(YamlMan *yaml_manager);
/// ///
/// \brief OscMan::get_gain /// \brief OscMan::get_shift
/// \return the gain value [double] /// \return the shift value [double]
/// ///
double get_shift(); double get_shift();
///
/// \brief get_gain
/// \return the master gain
///
double get_gain();
}; };
......
...@@ -21,7 +21,8 @@ YamlMan::YamlMan(std::string filepath) ...@@ -21,7 +21,8 @@ YamlMan::YamlMan(std::string filepath)
// read values // read values
port = config["port"].as<int>(); port = config["port"].as<int>();
path = config["path"].as<std::string>(); path1 = config["path1"].as<std::string>();
path2 = config["path2"].as<std::string>();
} }
...@@ -33,11 +34,12 @@ int YamlMan::return_port() ...@@ -33,11 +34,12 @@ int YamlMan::return_port()
} }
std::string YamlMan::return_path() std::string YamlMan::return_path_1()
{ {
return path1;
return path;
} }
std::string YamlMan::return_path_2()
{
return path2;
}
...@@ -36,9 +36,14 @@ private: ...@@ -36,9 +36,14 @@ private:
/// The OSC port to be used for receiving messages /// The OSC port to be used for receiving messages
int port; int port;
/// \brief path /// \brief path1
/// The OSC path used for the parameter /// The OSC path used for the first parameter
std::string path; std::string path1;
/// \brief path2
/// The OSC path used for the second parameter
std::string path2;
public: public:
...@@ -51,12 +56,15 @@ public: ...@@ -51,12 +56,15 @@ public:
/// \return The OSC port to be used /// \return The OSC port to be used
int return_port(); int return_port();
/// \brief return_path /// \brief return_path_1
/// Returns the OSC path used ///
/// to change the gain of the signal. /// \return getter for path #1
string return_path_1();
/// \brief return_path_2
/// ///
/// \return The OSC path. /// \return getter for path #2
string return_path(); string return_path_2();
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment