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 3298a00e by Jonas Margraf

fix shift OSC print out, add gain control via OSC

parent 2068463c
port: 6666
path: "/shift"
dummy: "lsrg"
path1: "/shift"
path2: "/gain"
......@@ -83,6 +83,7 @@ int AmExample::process(jack_nframes_t nframes)
// get the recent carrier frequency
// value from the OSC manager
double tmpGain = oscman->get_gain();
double shift = oscman->get_shift();
// set sinusoid parameter
......@@ -106,7 +107,7 @@ int AmExample::process(jack_nframes_t nframes)
for(int chanCNT=0; chanCNT<nChannels; chanCNT++)
{
// apply AM
out[chanCNT][sampCNT] = in[chanCNT][sampCNT] * tmpVal ;
out[chanCNT][sampCNT] = in[chanCNT][sampCNT] * tmpVal * tmpGain ;
}
}
......
......@@ -21,6 +21,7 @@ OscMan::OscMan(YamlMan *yaml_manager)
cout << "Receiving OSC on port: " << port << std::endl;
shift = 1.0;
gain = 1.0;
try
......@@ -33,7 +34,11 @@ OscMan::OscMan(YamlMan *yaml_manager)
}
// 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();
......@@ -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 argc, void *data, void *user_data )
{
......@@ -49,14 +68,18 @@ int argc, void *data, void *user_data )
// Do a static cast
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;
}
double OscMan::get_shift()
{
return shift;
}
double OscMan::get_gain()
{
return gain;
}
......@@ -39,10 +39,24 @@ private:
///
lo::ServerThread *st;
/// The actual gain value
/// The actual shift value
double shift;
/// The master gain value
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
////// \param path
////// \param types
......@@ -66,11 +80,17 @@ public:
OscMan(YamlMan *yaml_manager);
///
/// \brief OscMan::get_gain
/// \return the gain value [double]
/// \brief OscMan::get_shift
/// \return the shift value [double]
///
double get_shift();
///
/// \brief get_gain
/// \return the master gain
///
double get_gain();
};
......
......@@ -21,7 +21,8 @@ YamlMan::YamlMan(std::string filepath)
// read values
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()
}
std::string YamlMan::return_path()
std::string YamlMan::return_path_1()
{
return path;
return path1;
}
std::string YamlMan::return_path_2()
{
return path2;
}
......@@ -36,9 +36,14 @@ private:
/// The OSC port to be used for receiving messages
int port;
/// \brief path
/// The OSC path used for the parameter
std::string path;
/// \brief path1
/// The OSC path used for the first parameter
std::string path1;
/// \brief path2
/// The OSC path used for the second parameter
std::string path2;
public:
......@@ -51,12 +56,15 @@ public:
/// \return The OSC port to be used
int return_port();
/// \brief return_path
/// Returns the OSC path used
/// to change the gain of the signal.
/// \brief return_path_1
///
/// \return getter for path #1
string return_path_1();
/// \brief return_path_2
///
/// \return The OSC path.
string return_path();
/// \return getter for path #2
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