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 b27a51d4 by Jonas Margraf

remove OscMan because this example doesn't use OSC

parent 9b2479b4
......@@ -7,16 +7,16 @@ CFLAGS = -I.
# libraries to link
LDFLAGS = -ljack -llo -lrtmidi
SRCS = main.cpp midi_sine_example.cpp oscman.cpp midiman.cpp sinusoid.cpp
DEPS = midi_sine_example.h oscman.h midiman.h sinusoid.h
SRCS = main.cpp midi_sine_example.cpp midiman.cpp sinusoid.cpp
DEPS = midi_sine_example.h midiman.h sinusoid.h
all: midi_sine_example
%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)
midi_sine_example: main.o midi_sine_example.o oscman.o midiman.o sinusoid.o
$(CC) -o midi_sine_example main.o midi_sine_example.o oscman.o midiman.o sinusoid.o $(LDFLAGS)
midi_sine_example: main.o midi_sine_example.o midiman.o sinusoid.o
$(CC) -o midi_sine_example main.o midi_sine_example.o midiman.o sinusoid.o $(LDFLAGS)
clean:
rm *.o midi_sine_example
......@@ -20,7 +20,6 @@
#include<jack/jack.h>
#include "oscman.h"
#include "midiman.h"
#include "sinusoid.h"
......@@ -59,9 +58,6 @@ private:
jack_port_t **output_port;
/// The OSC manager object
OscMan *oscman;
/// an array of sinusoids
Sinusoid *sines;
......@@ -85,11 +81,8 @@ private:
public:
/// \brief GainExample
/// \brief MidiSineExample
/// Constructor!
MidiSineExample(int ID, int nPart);
};
/**
* \file oscman.cpp
* \class OscMan
*
* \brief Class which parses the incoming OSC messages.
*
* \author Henrik von Coler
*
* \date 2019/03/18
*
*/
#include "oscman.h"
OscMan::OscMan(int p)
{
port = p;
speed = 0.05;
st = new lo::ServerThread(port);
if (st->is_valid())
{
// Add the example handler to the server!
st->add_method("/speed", "f", speed_callback, this);
// start, obviously
st->start();
std::cout << "Started OSC Server!" << std::endl;
}
else
throw std::invalid_argument("OSC server not started - possibly a bad port!");
}
int OscMan::speed_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 playback speed to: " << argv[0]->f << std::endl;
statCast->speed = argv[0]->f;
}
double OscMan::get_speed()
{
return speed;
}
/**
* \file oscman.h
* \class OscMan
*
* \brief Class which parses the incoming OSC messages.
*
* \author Henrik von Coler
*
* \date 2019/03/18$
*
*/
#ifndef OSCMAN_H
#define OSCMAN_H
// works with 'self built'
#include <lo/lo.h>
#include <lo/lo_cpp.h>
#include<iostream>
#include<vector>
#include<string>
#include <stdexcept>
class OscMan
{
private:
/// the port to be opened
int port;
lo::ServerThread *st;
double speed;
///
////// \brief OscMan::speed_callback
////// \param path
////// \param types
////// \param argv
////// \param argc
////// \param data
////// \param user_data
////// \return
static int speed_callback(const char *path, const char *types, lo_arg ** argv,
int argc, void *data, void *user_data);
public:
///
/// \brief OscMan::OscMan
/// \param p
///
OscMan(int p);
///
/// \brief OscMan::get_speed
/// \return
///
double get_speed();
};
#endif
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