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 e929d24f by Henrik von Coler

Before Introduction II

parent e62ce144
......@@ -7,6 +7,7 @@ CFLAGS = -I.
# libraries to link
LDFLAGS = -ljack -llo -lyaml-cpp
# all sources and dependencies
SRCS = main.cpp gain_example.cpp oscman.cpp yamlman.cpp
DEPS = oscman.h gain_example.h yamlman.h
......@@ -18,6 +19,5 @@ all: gain_example
gain_example: main.o gain_example.o oscman.o yamlman.o
$(CC) -o gain_example main.o gain_example.o oscman.o yamlman.o $(LDFLAGS)
clean:
rm *.o gain_example
......@@ -20,8 +20,6 @@ using std::endl;
GainExample::GainExample(YamlMan *yaml_manager){
/// @todo Add examples for the TODO list.
// creating an OSC manager instance
oscman = new OscMan(yaml_manager);
......@@ -56,21 +54,16 @@ GainExample::GainExample(YamlMan *yaml_manager){
out = new jack_default_audio_sample_t*;
in = new jack_default_audio_sample_t*;
jack_activate(this->client);
// connect inputs
jack_connect (client, "system:capture_1", jack_port_name(input_port[0]));
jack_connect (client, "system:capture_2", jack_port_name(input_port[1]));
// connect outputs
jack_connect (client, jack_port_name(output_port[0]), "system:playback_1");
jack_connect (client, jack_port_name(output_port[1]), "system:playback_2");
// run forever
sleep (-1);
......@@ -81,17 +74,19 @@ GainExample::GainExample(YamlMan *yaml_manager){
int GainExample::process(jack_nframes_t nframes)
{
// get the recent gain value from the OSC manager
double gain = oscman->get_gain();
// get buffers
// get input buffers
for ( int i=0 ; i<nChannels; i++)
{
out[i] = (jack_default_audio_sample_t *) jack_port_get_buffer(this->output_port[i], jack_get_buffer_size(client));
in[i] = (jack_default_audio_sample_t *) jack_port_get_buffer(this->input_port[i], jack_get_buffer_size(client));
out[i] = (jack_default_audio_sample_t *)
jack_port_get_buffer(this->output_port[i], jack_get_buffer_size(client));
in[i] = (jack_default_audio_sample_t *)
jack_port_get_buffer(this->input_port[i], jack_get_buffer_size(client));
}
// write all input samples to output
for(int chanCNT=0; chanCNT<nChannels; chanCNT++)
{
for(int sampCNT=0; sampCNT<nframes; sampCNT++)
......
......@@ -61,6 +61,10 @@ private:
/// the jack output ports
jack_port_t **output_port;
///
/// \brief in
///
/// \brief out
jack_default_audio_sample_t **in, **out;
......@@ -76,8 +80,10 @@ private:
///
/// \brief callback_process
/// \param x
/// \param object
/// is used to access the members of this
/// class in the static mode
/// \param x number of samples in the buffer
/// \param object void pointer
/// \return
///
static int callback_process(jack_nframes_t x, void* object);
......
......@@ -10,7 +10,6 @@
*/
#include"yamlman.h"
#include"oscman.h"
#include"gain_example.h"
......@@ -23,14 +22,12 @@ using std::endl;
int main(int argc, char *argv[]){
if (argc < 3)
cout << "Need config file to start!" << endl;
else{
// process command line arguments
std::string configfile;
for (int i = 1; i < argc; i++)
......@@ -45,11 +42,8 @@ int main(int argc, char *argv[]){
}
}
// initialize objects
YamlMan *yaml_manager = new YamlMan(configfile);
/// initial ports from constructor created here.
GainExample *t = new GainExample(yaml_manager);
}
}
......@@ -19,10 +19,8 @@ OscMan::OscMan(YamlMan *yaml_manager)
port = yaml_manager->return_port();
cout << "Receiving OSC on port: " << port << std::endl;
gain = 1.0;
try
......@@ -32,7 +30,6 @@ OscMan::OscMan(YamlMan *yaml_manager)
catch (int e)
{
std::cout << "Possibly a bad port!" << std::endl;
}
// Add the example handler to the server!
......@@ -44,7 +41,6 @@ OscMan::OscMan(YamlMan *yaml_manager)
}
int OscMan::gain_callback(const char *path, const char *types, lo_arg ** argv,
int argc, void *data, void *user_data )
{
......
......@@ -19,8 +19,8 @@ YamlMan::YamlMan(std::string filepath)
YAML::Node config = YAML::LoadFile(filepath);
// read values
port = config["port"].as<int>();
path = config["path"].as<std::string>();
}
......
......@@ -82,7 +82,6 @@ WavExample::WavExample(std::string filename){
}
int WavExample::process (jack_nframes_t nframes)
{
......@@ -122,26 +121,3 @@ int WavExample::callback_process(jack_nframes_t x, void* object)
return static_cast<WavExample*>(object)->process(x);
}
int main(int argc, char *argv[]){
std::string filename;
for (int i = 1; i < argc; i++)
{
if (i + 1 != argc)
{
if (strcmp(argv[i], "-f") == 0)
{
filename = argv[i + 1];
i++;
}
}
}
/// initial ports from constructor created here.
WavExample * t = new WavExample(filename);
}
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