mirror of
https://github.com/vale981/openAV-Luppp
synced 2025-03-04 16:51:37 -05:00
Fixes a few leaks and errors
This commit is contained in:
parent
a332d9b0fe
commit
c5d33f89cd
26 changed files with 76 additions and 141 deletions
|
@ -10,6 +10,7 @@ set(LUPPP_VERSION_PATCH "1")
|
||||||
set(LUPPP_VERSION "${LUPPP_VERSION_MAJOR}.${LUPPP_VERSION_MINOR}.${LUPPP_VERSION_PATCH}")
|
set(LUPPP_VERSION "${LUPPP_VERSION_MAJOR}.${LUPPP_VERSION_MINOR}.${LUPPP_VERSION_PATCH}")
|
||||||
|
|
||||||
option(BUILD_TESTS "Build test version" OFF)
|
option(BUILD_TESTS "Build test version" OFF)
|
||||||
|
option(WITH_ASAN "Build address sanitized version" OFF)
|
||||||
|
|
||||||
|
|
||||||
#set(CMAKE_VERBOSE_MAKEFILE on)
|
#set(CMAKE_VERBOSE_MAKEFILE on)
|
||||||
|
|
|
@ -50,7 +50,14 @@ IF(RELEASE_BUILD)
|
||||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -Wall -W -Wno-unused-variable ")
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -Wall -W -Wno-unused-variable ")
|
||||||
ENDIF(RELEASE_BUILD)
|
ENDIF(RELEASE_BUILD)
|
||||||
|
|
||||||
if( ${ARCHITECTURE} STREQUAL "x86_64" )
|
IF(WITH_ASAN)
|
||||||
|
SET(CMAKE_C_COMPILER "/usr/bin/clang")
|
||||||
|
SET(CMAKE_CXX_COMPILER "/usr/bin/clang++")
|
||||||
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -g -fsanitize=address -fno-omit-frame-pointer")
|
||||||
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -g -fsanitize=address -fno-omit-frame-pointer")
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
if( ${ARCHITECTURE} STREQUAL "x86_64" AND NOT WITH_ASAN)
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -msse2")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -msse2")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -msse2")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -msse2")
|
||||||
else()
|
else()
|
||||||
|
@ -63,6 +70,12 @@ FILE(GLOB sources *.cxx avtk/*.cxx cjson/*.c controller/*.cxx dsp/*.cxx observe
|
||||||
# Compile binary
|
# Compile binary
|
||||||
add_executable (luppp version.hxx ${sources} )
|
add_executable (luppp version.hxx ${sources} )
|
||||||
|
|
||||||
|
# require a C++11 compiler
|
||||||
|
set_target_properties(luppp PROPERTIES
|
||||||
|
CXX_STANDARD 11
|
||||||
|
CXX_STANDARD_REQUIRED YES
|
||||||
|
CXX_EXTENSIONS NO
|
||||||
|
)
|
||||||
|
|
||||||
# Linking
|
# Linking
|
||||||
target_link_libraries( luppp ${JACK_LIBRARIES} )
|
target_link_libraries( luppp ${JACK_LIBRARIES} )
|
||||||
|
|
|
@ -34,33 +34,18 @@ class Background : public Fl_Widget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Background(int _x, int _y, int _w, int _h, const char *_label = 0):
|
Background(int _x, int _y, int _w, int _h, const char *_label = 0):
|
||||||
Fl_Widget(_x, _y, _w, _h, _label)
|
Fl_Widget(_x, _y, _w, _h)
|
||||||
{
|
{
|
||||||
|
copy_label(_label);
|
||||||
x = _x;
|
x = _x;
|
||||||
y = _y;
|
y = _y;
|
||||||
w = _w;
|
w = _w;
|
||||||
h = _h;
|
h = _h;
|
||||||
|
|
||||||
label = strdup(_label);
|
|
||||||
|
|
||||||
highlight = false;
|
highlight = false;
|
||||||
}
|
}
|
||||||
bool highlight;
|
bool highlight;
|
||||||
int x, y, w, h;
|
int x, y, w, h;
|
||||||
const char* label;
|
|
||||||
|
|
||||||
void setLabel(const char* l)
|
|
||||||
{
|
|
||||||
if( label )
|
|
||||||
free( (char*) label);
|
|
||||||
|
|
||||||
label = strdup( l );
|
|
||||||
redraw();
|
|
||||||
}
|
|
||||||
const char* getLabel()
|
|
||||||
{
|
|
||||||
return label;
|
|
||||||
}
|
|
||||||
|
|
||||||
void draw()
|
void draw()
|
||||||
{
|
{
|
||||||
|
@ -87,7 +72,7 @@ public:
|
||||||
cairo_move_to( cr, x + 10, y + 14 );
|
cairo_move_to( cr, x + 10, y + 14 );
|
||||||
cairo_set_source_rgba( cr, 0 / 255.f, 153 / 255.f , 255 / 255.f , 1 );
|
cairo_set_source_rgba( cr, 0 / 255.f, 153 / 255.f , 255 / 255.f , 1 );
|
||||||
cairo_set_font_size( cr, 10 );
|
cairo_set_font_size( cr, 10 );
|
||||||
cairo_show_text( cr, label );
|
cairo_show_text( cr, label() );
|
||||||
|
|
||||||
// lower stripe
|
// lower stripe
|
||||||
cairo_move_to( cr, x , y + 20 );
|
cairo_move_to( cr, x , y + 20 );
|
||||||
|
@ -122,8 +107,7 @@ public:
|
||||||
if ( Fl::event_state(FL_BUTTON3) && Fl::event_y() < y + 20 ) {
|
if ( Fl::event_state(FL_BUTTON3) && Fl::event_y() < y + 20 ) {
|
||||||
const char* name = fl_input( "Track name: ", "" );
|
const char* name = fl_input( "Track name: ", "" );
|
||||||
if ( name ) {
|
if ( name ) {
|
||||||
free( (char*) label );
|
copy_label(name);
|
||||||
label = strdup( name );
|
|
||||||
redraw();
|
redraw();
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -30,8 +30,9 @@ class Box : public Fl_Widget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Box(int _x, int _y, int _w, int _h, const char *_label = 0):
|
Box(int _x, int _y, int _w, int _h, const char *_label = 0):
|
||||||
Fl_Widget(_x, _y, _w, _h, _label)
|
Fl_Widget(_x, _y, _w, _h)
|
||||||
{
|
{
|
||||||
|
copy_label(_label);
|
||||||
x = _x;
|
x = _x;
|
||||||
y = _y;
|
y = _y;
|
||||||
w = _w;
|
w = _w;
|
||||||
|
@ -39,29 +40,13 @@ public:
|
||||||
|
|
||||||
r = g = b = 0;
|
r = g = b = 0;
|
||||||
|
|
||||||
label = strdup(_label);
|
|
||||||
|
|
||||||
highlight = false;
|
highlight = false;
|
||||||
}
|
}
|
||||||
bool highlight;
|
bool highlight;
|
||||||
int x, y, w, h;
|
int x, y, w, h;
|
||||||
const char* label;
|
|
||||||
|
|
||||||
int r,g,b;
|
int r,g,b;
|
||||||
|
|
||||||
void setLabel(const char* l)
|
|
||||||
{
|
|
||||||
if( label )
|
|
||||||
free( (char*) label);
|
|
||||||
|
|
||||||
label = strdup( l );
|
|
||||||
redraw();
|
|
||||||
}
|
|
||||||
const char* getLabel()
|
|
||||||
{
|
|
||||||
return label;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setColor( int red, int green, int blue )
|
void setColor( int red, int green, int blue )
|
||||||
{
|
{
|
||||||
r = red;
|
r = red;
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#ifndef AVTK_BUTTON_H
|
#ifndef AVTK_BUTTON_H
|
||||||
#define AVTK_BUTTON_H
|
#define AVTK_BUTTON_H
|
||||||
|
|
||||||
#include <FL/Fl_Button.H>
|
#include <ntk/FL/Fl_Button.H>
|
||||||
|
|
||||||
namespace Avtk
|
namespace Avtk
|
||||||
{
|
{
|
||||||
|
@ -29,16 +29,14 @@ class Button : public Fl_Button
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Button(int _x, int _y, int _w, int _h, const char *_label):
|
Button(int _x, int _y, int _w, int _h, const char *_label):
|
||||||
Fl_Button(_x, _y, _w, _h, _label)
|
Fl_Button(_x, _y, _w, _h)
|
||||||
{
|
{
|
||||||
|
copy_label(_label);
|
||||||
x = _x;
|
x = _x;
|
||||||
y = _y;
|
y = _y;
|
||||||
w = _w;
|
w = _w;
|
||||||
h = _h;
|
h = _h;
|
||||||
|
|
||||||
labelMe = _label;
|
|
||||||
setLabel( labelMe );
|
|
||||||
|
|
||||||
_r = 1.0;
|
_r = 1.0;
|
||||||
_g = 0.48;
|
_g = 0.48;
|
||||||
_b = 0.0;
|
_b = 0.0;
|
||||||
|
@ -63,14 +61,6 @@ public:
|
||||||
bool mouseOver;
|
bool mouseOver;
|
||||||
bool highlight;
|
bool highlight;
|
||||||
int x, y, w, h;
|
int x, y, w, h;
|
||||||
const char* labelMe;
|
|
||||||
|
|
||||||
void setLabel( const char* l)
|
|
||||||
{
|
|
||||||
labelMe = l;
|
|
||||||
label( labelMe );
|
|
||||||
redraw();
|
|
||||||
}
|
|
||||||
|
|
||||||
float _r, _g, _b; // foreground colour
|
float _r, _g, _b; // foreground colour
|
||||||
float _bgr, _bgg, _bgb; // background colour
|
float _bgr, _bgg, _bgb; // background colour
|
||||||
|
|
|
@ -44,13 +44,6 @@ public:
|
||||||
mouseClicked = false;
|
mouseClicked = false;
|
||||||
|
|
||||||
highlight = false;
|
highlight = false;
|
||||||
_label = strdup( _lab );
|
|
||||||
}
|
|
||||||
|
|
||||||
~Dial()
|
|
||||||
{
|
|
||||||
if( _label )
|
|
||||||
free( _label );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool highlight;
|
bool highlight;
|
||||||
|
@ -66,17 +59,6 @@ public:
|
||||||
|
|
||||||
bool drawLabel;
|
bool drawLabel;
|
||||||
|
|
||||||
void setLabel( const char* newLabel )
|
|
||||||
{
|
|
||||||
if( _label )
|
|
||||||
free( _label );
|
|
||||||
|
|
||||||
_label = strdup( newLabel );
|
|
||||||
|
|
||||||
label( _label );
|
|
||||||
redraw();
|
|
||||||
}
|
|
||||||
|
|
||||||
void draw()
|
void draw()
|
||||||
{
|
{
|
||||||
if (damage() & FL_DAMAGE_ALL) {
|
if (damage() & FL_DAMAGE_ALL) {
|
||||||
|
|
|
@ -29,7 +29,7 @@ class LightButton : public Fl_Button
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LightButton(int _x, int _y, int _w, int _h, const char *_label):
|
LightButton(int _x, int _y, int _w, int _h, const char *_label):
|
||||||
Fl_Button(_x, _y, _w, _h, _label)
|
Fl_Button(_x, _y, _w, _h)
|
||||||
{
|
{
|
||||||
x = _x;
|
x = _x;
|
||||||
y = _y;
|
y = _y;
|
||||||
|
@ -48,8 +48,6 @@ public:
|
||||||
_outg = _g;
|
_outg = _g;
|
||||||
_outb = _b;
|
_outb = _b;
|
||||||
|
|
||||||
label = _label;
|
|
||||||
|
|
||||||
_highlight = false;
|
_highlight = false;
|
||||||
mouseOver = false;
|
mouseOver = false;
|
||||||
}
|
}
|
||||||
|
@ -57,7 +55,6 @@ public:
|
||||||
bool mouseOver;
|
bool mouseOver;
|
||||||
bool _highlight;
|
bool _highlight;
|
||||||
int x, y, w, h;
|
int x, y, w, h;
|
||||||
const char* label;
|
|
||||||
float _r, _g, _b; // foreground colour
|
float _r, _g, _b; // foreground colour
|
||||||
float _bgr, _bgg, _bgb; // background colour
|
float _bgr, _bgg, _bgb; // background colour
|
||||||
float _outr, _outg, _outb; // outline colour
|
float _outr, _outg, _outb; // outline colour
|
||||||
|
|
|
@ -29,15 +29,14 @@ class RadialStatus : public Fl_Slider
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RadialStatus(int _x, int _y, int _w, int _h, const char *_label = 0):
|
RadialStatus(int _x, int _y, int _w, int _h, const char *_label = 0):
|
||||||
Fl_Slider(_x, _y, _w, _h, _label)
|
Fl_Slider(_x, _y, _w, _h)
|
||||||
{
|
{
|
||||||
|
copy_label(_label);
|
||||||
x = _x;
|
x = _x;
|
||||||
y = _y;
|
y = _y;
|
||||||
w = _w;
|
w = _w;
|
||||||
h = _h;
|
h = _h;
|
||||||
|
|
||||||
label = _label;
|
|
||||||
|
|
||||||
previousAngle = -1;
|
previousAngle = -1;
|
||||||
|
|
||||||
_r = 1.0;
|
_r = 1.0;
|
||||||
|
@ -64,8 +63,6 @@ public:
|
||||||
bool mouseOver;
|
bool mouseOver;
|
||||||
bool highlight;
|
bool highlight;
|
||||||
int x, y, w, h;
|
int x, y, w, h;
|
||||||
const char* label;
|
|
||||||
|
|
||||||
int previousAngle;
|
int previousAngle;
|
||||||
|
|
||||||
float _r, _g, _b; // foreground colour
|
float _r, _g, _b; // foreground colour
|
||||||
|
|
|
@ -29,8 +29,9 @@ class Reverb : public Fl_Slider
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Reverb(int _x, int _y, int _w, int _h, const char *_label =0):
|
Reverb(int _x, int _y, int _w, int _h, const char *_label =0):
|
||||||
Fl_Slider(_x, _y, _w, _h, _label)
|
Fl_Slider(_x, _y, _w, _h)
|
||||||
{
|
{
|
||||||
|
copy_label(_label);
|
||||||
x = _x;
|
x = _x;
|
||||||
y = _y;
|
y = _y;
|
||||||
w = _w;
|
w = _w;
|
||||||
|
@ -42,8 +43,6 @@ public:
|
||||||
|
|
||||||
active = false;
|
active = false;
|
||||||
|
|
||||||
label = _label;
|
|
||||||
|
|
||||||
highlight = false;
|
highlight = false;
|
||||||
mouseOver = false;
|
mouseOver = false;
|
||||||
}
|
}
|
||||||
|
@ -96,7 +95,6 @@ public:
|
||||||
bool mouseOver;
|
bool mouseOver;
|
||||||
bool highlight;
|
bool highlight;
|
||||||
int x, y, w, h;
|
int x, y, w, h;
|
||||||
const char* label;
|
|
||||||
|
|
||||||
void draw()
|
void draw()
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,15 +34,14 @@ class SidechainGain : public Fl_Slider
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SidechainGain(int _x, int _y, int _w, int _h, const char *_label = 0):
|
SidechainGain(int _x, int _y, int _w, int _h, const char *_label = 0):
|
||||||
Fl_Slider(_x, _y, _w, _h, _label)
|
Fl_Slider(_x, _y, _w, _h)
|
||||||
{
|
{
|
||||||
|
copy_label(_label);
|
||||||
x = _x;
|
x = _x;
|
||||||
y = _y;
|
y = _y;
|
||||||
w = _w;
|
w = _w;
|
||||||
h = _h;
|
h = _h;
|
||||||
|
|
||||||
label = _label;
|
|
||||||
|
|
||||||
mouseClickedX = 0;
|
mouseClickedX = 0;
|
||||||
mouseClickedY = 0;
|
mouseClickedY = 0;
|
||||||
mouseClicked = false;
|
mouseClicked = false;
|
||||||
|
@ -84,7 +83,6 @@ public:
|
||||||
bool active;
|
bool active;
|
||||||
bool highlight;
|
bool highlight;
|
||||||
int x, y, w, h;
|
int x, y, w, h;
|
||||||
const char* label;
|
|
||||||
|
|
||||||
int mouseClickedX;
|
int mouseClickedX;
|
||||||
int mouseClickedY;
|
int mouseClickedY;
|
||||||
|
|
|
@ -57,15 +57,14 @@ class Unit : public Fl_Button
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Unit(int _x, int _y, int _w, int _h, const char *_label):
|
Unit(int _x, int _y, int _w, int _h, const char *_label):
|
||||||
Fl_Button(_x, _y, _w, _h, _label)
|
Fl_Button(_x, _y, _w, _h)
|
||||||
{
|
{
|
||||||
|
copy_label(_label);
|
||||||
x = _x;
|
x = _x;
|
||||||
y = _y;
|
y = _y;
|
||||||
w = _w;
|
w = _w;
|
||||||
h = _h;
|
h = _h;
|
||||||
|
|
||||||
label = _label;
|
|
||||||
|
|
||||||
highlight = false;
|
highlight = false;
|
||||||
mouseOver = false;
|
mouseOver = false;
|
||||||
|
|
||||||
|
@ -83,7 +82,6 @@ public:
|
||||||
bool mouseOver;
|
bool mouseOver;
|
||||||
bool highlight;
|
bool highlight;
|
||||||
int x, y, w, h;
|
int x, y, w, h;
|
||||||
const char* label;
|
|
||||||
|
|
||||||
void draw()
|
void draw()
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,15 +27,14 @@ namespace Avtk
|
||||||
{
|
{
|
||||||
|
|
||||||
Bindings::Bindings( int _x, int _y, int _w, int _h, const char *_label ) :
|
Bindings::Bindings( int _x, int _y, int _w, int _h, const char *_label ) :
|
||||||
Fl_Button(_x, _y, _w, _h, _label)
|
Fl_Button(_x, _y, _w, _h)
|
||||||
{
|
{
|
||||||
|
copy_label(_label);
|
||||||
x = _x;
|
x = _x;
|
||||||
y = _y;
|
y = _y;
|
||||||
w = _w;
|
w = _w;
|
||||||
h = _h;
|
h = _h;
|
||||||
|
|
||||||
label = _label;
|
|
||||||
|
|
||||||
bindYPx = 25;
|
bindYPx = 25;
|
||||||
|
|
||||||
highlight = false;
|
highlight = false;
|
||||||
|
|
|
@ -37,7 +37,6 @@ public:
|
||||||
bool mouseOver;
|
bool mouseOver;
|
||||||
bool highlight;
|
bool highlight;
|
||||||
int x, y, w, h;
|
int x, y, w, h;
|
||||||
const char* label;
|
|
||||||
|
|
||||||
void add( Binding* b );
|
void add( Binding* b );
|
||||||
|
|
||||||
|
|
|
@ -32,8 +32,9 @@ namespace Avtk
|
||||||
|
|
||||||
ClipSelector::ClipSelector( int _x, int _y, int _w, int _h,
|
ClipSelector::ClipSelector( int _x, int _y, int _w, int _h,
|
||||||
const char *_label, bool master ) :
|
const char *_label, bool master ) :
|
||||||
Fl_Button(_x, _y, _w, _h, _label)
|
Fl_Button(_x, _y, _w, _h)
|
||||||
{
|
{
|
||||||
|
copy_label(_label);
|
||||||
x = _x;
|
x = _x;
|
||||||
y = _y;
|
y = _y;
|
||||||
w = _w;
|
w = _w;
|
||||||
|
@ -41,7 +42,6 @@ ClipSelector::ClipSelector( int _x, int _y, int _w, int _h,
|
||||||
|
|
||||||
special = -1;
|
special = -1;
|
||||||
|
|
||||||
label = _label;
|
|
||||||
_master = master;
|
_master = master;
|
||||||
|
|
||||||
if ( _master ) {
|
if ( _master ) {
|
||||||
|
|
|
@ -89,7 +89,6 @@ public:
|
||||||
bool mouseOver;
|
bool mouseOver;
|
||||||
bool highlight;
|
bool highlight;
|
||||||
int x, y, w, h;
|
int x, y, w, h;
|
||||||
const char* label;
|
|
||||||
|
|
||||||
void setID( int id );
|
void setID( int id );
|
||||||
|
|
||||||
|
|
|
@ -21,15 +21,14 @@
|
||||||
using namespace Avtk;
|
using namespace Avtk;
|
||||||
|
|
||||||
Volume::Volume(int _x, int _y, int _w, int _h, const char *_label ):
|
Volume::Volume(int _x, int _y, int _w, int _h, const char *_label ):
|
||||||
Fl_Slider(_x, _y, _w, _h, _label)
|
Fl_Slider(_x, _y, _w, _h)
|
||||||
{
|
{
|
||||||
|
copy_label(_label);
|
||||||
x = _x;
|
x = _x;
|
||||||
y = _y;
|
y = _y;
|
||||||
w = _w;
|
w = _w;
|
||||||
h = _h;
|
h = _h;
|
||||||
|
|
||||||
label = _label;
|
|
||||||
|
|
||||||
mouseClickedX = 0;
|
mouseClickedX = 0;
|
||||||
mouseClickedY = 0;
|
mouseClickedY = 0;
|
||||||
mouseClicked = false;
|
mouseClicked = false;
|
||||||
|
|
|
@ -52,7 +52,6 @@ private:
|
||||||
bool orientationHorizontal;
|
bool orientationHorizontal;
|
||||||
|
|
||||||
int x, y, w, h;
|
int x, y, w, h;
|
||||||
const char* label;
|
|
||||||
|
|
||||||
int mouseClickedX;
|
int mouseClickedX;
|
||||||
int mouseClickedY;
|
int mouseClickedY;
|
||||||
|
|
|
@ -35,29 +35,27 @@ class Waveform : public Fl_Widget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Waveform(int _x, int _y, int _w, int _h, const char *_label=0 ):
|
Waveform(int _x, int _y, int _w, int _h, const char *_label=0 ):
|
||||||
Fl_Widget(_x, _y, _w, _h, _label)
|
Fl_Widget(_x, _y, _w, _h),
|
||||||
|
data(_w)
|
||||||
{
|
{
|
||||||
|
copy_label(_label);
|
||||||
x = _x;
|
x = _x;
|
||||||
y = _y;
|
y = _y;
|
||||||
w = _w;
|
w = _w;
|
||||||
h = _h;
|
h = _h;
|
||||||
|
|
||||||
label = _label;
|
|
||||||
|
|
||||||
highlight = false;
|
highlight = false;
|
||||||
newWaveform = false;
|
newWaveform = false;
|
||||||
|
|
||||||
waveformCr = 0;
|
waveformCr = 0;
|
||||||
waveformSurf = 0;
|
waveformSurf = 0;
|
||||||
|
|
||||||
|
|
||||||
data = (float*)malloc( sizeof(float) * w );
|
|
||||||
|
|
||||||
srand (time(NULL));
|
srand (time(NULL));
|
||||||
|
|
||||||
for (int i = 0; i < _w; i++) {
|
std::generate(data.begin(), data.end(), []() -> float {
|
||||||
data[i] = rand() / RAND_MAX / 0.75;
|
return rand() / RAND_MAX / 0.75;
|
||||||
}
|
}
|
||||||
|
);
|
||||||
|
|
||||||
newWaveform = true;
|
newWaveform = true;
|
||||||
|
|
||||||
|
@ -67,7 +65,6 @@ public:
|
||||||
bool strokeRim;
|
bool strokeRim;
|
||||||
bool highlight;
|
bool highlight;
|
||||||
int x, y, w, h;
|
int x, y, w, h;
|
||||||
const char* label;
|
|
||||||
|
|
||||||
cairo_t* waveformCr;
|
cairo_t* waveformCr;
|
||||||
cairo_surface_t* waveformSurf;
|
cairo_surface_t* waveformSurf;
|
||||||
|
@ -75,13 +72,12 @@ public:
|
||||||
bool newWaveform;
|
bool newWaveform;
|
||||||
|
|
||||||
long dataSize;
|
long dataSize;
|
||||||
float* data;
|
std::vector<float> data;
|
||||||
|
|
||||||
void setData( float* d, long size )
|
void setData( const std::vector<float>& newdata )
|
||||||
{
|
{
|
||||||
//cout << "AvtkWaveform: setDataPtr = " << data << endl;
|
//cout << "AvtkWaveform: setDataPtr = " << data << endl;
|
||||||
dataSize = size;
|
data = newdata;
|
||||||
data = d;
|
|
||||||
newWaveform = true;
|
newWaveform = true;
|
||||||
|
|
||||||
|
|
||||||
|
@ -137,7 +133,7 @@ public:
|
||||||
cairo_set_dash ( waveformCr, dashes, 0, 0.0);
|
cairo_set_dash ( waveformCr, dashes, 0, 0.0);
|
||||||
|
|
||||||
|
|
||||||
if ( !data ) {
|
if ( !data.empty() ) {
|
||||||
// draw X
|
// draw X
|
||||||
cairo_move_to( cr, 0 , 0 );
|
cairo_move_to( cr, 0 , 0 );
|
||||||
cairo_line_to( cr, 0 + w, 0 + h );
|
cairo_line_to( cr, 0 + w, 0 + h );
|
||||||
|
@ -241,11 +237,8 @@ public:
|
||||||
|
|
||||||
// FIXME: needs to be resampled, not clipped at end
|
// FIXME: needs to be resampled, not clipped at end
|
||||||
// delete old data, and resize it
|
// delete old data, and resize it
|
||||||
float* newData = (float*)malloc( sizeof(float) * w );
|
|
||||||
|
|
||||||
memcpy( newData, data, newSize );
|
data.resize(w);
|
||||||
free ( data );
|
|
||||||
data = newData;
|
|
||||||
|
|
||||||
newWaveform = true;
|
newWaveform = true;
|
||||||
|
|
||||||
|
|
|
@ -596,7 +596,7 @@ int DiskReader::readTracks()
|
||||||
if( !name ) {
|
if( !name ) {
|
||||||
LUPPP_WARN("Track %i has no name data saved.", t);
|
LUPPP_WARN("Track %i has no name data saved.", t);
|
||||||
} else {
|
} else {
|
||||||
gui->getTrack(t)->bg.setLabel( name->valuestring );
|
gui->getTrack(t)->bg.copy_label( name->valuestring );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// fader
|
// fader
|
||||||
|
|
|
@ -88,7 +88,14 @@ DiskWriter::DiskWriter()
|
||||||
} else {
|
} else {
|
||||||
LUPPP_NOTE("Creating .config/openAV/luppp directory");
|
LUPPP_NOTE("Creating .config/openAV/luppp directory");
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
|
DiskWriter::~DiskWriter()
|
||||||
|
{
|
||||||
|
// reset the cJSON objects
|
||||||
|
cJSON_Delete( sessionJson );
|
||||||
|
cJSON_Delete( audioJson );
|
||||||
|
}
|
||||||
|
|
||||||
void DiskWriter::initialize(std::string path, std::string name )
|
void DiskWriter::initialize(std::string path, std::string name )
|
||||||
{
|
{
|
||||||
|
@ -396,7 +403,7 @@ int DiskWriter::writeSession()
|
||||||
|
|
||||||
// add track metadata: volumes, sends etc
|
// add track metadata: volumes, sends etc
|
||||||
cJSON_AddNumberToObject( track, "ID", t );
|
cJSON_AddNumberToObject( track, "ID", t );
|
||||||
cJSON_AddStringToObject( track, "name", gui->getTrack(t)->bg.getLabel() );
|
cJSON_AddStringToObject( track, "name", gui->getTrack(t)->bg.label() );
|
||||||
|
|
||||||
cJSON_AddNumberToObject( track, "fader", gui->getTrack(t)->getVolume()->value() );
|
cJSON_AddNumberToObject( track, "fader", gui->getTrack(t)->getVolume()->value() );
|
||||||
cJSON_AddNumberToObject( track, "pan", gui->getTrack(t)->getPan());
|
cJSON_AddNumberToObject( track, "pan", gui->getTrack(t)->getPan());
|
||||||
|
|
|
@ -54,6 +54,7 @@ class DiskWriter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DiskWriter();
|
DiskWriter();
|
||||||
|
~DiskWriter();
|
||||||
|
|
||||||
/// sets up session write path etc
|
/// sets up session write path etc
|
||||||
void initialize( std::string path, std::string sessionName );
|
void initialize( std::string path, std::string sessionName );
|
||||||
|
@ -82,8 +83,8 @@ public:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
cJSON* sessionJson;
|
cJSON* sessionJson = nullptr;
|
||||||
cJSON* audioJson;
|
cJSON* audioJson = nullptr;
|
||||||
|
|
||||||
bool foldersCreated;
|
bool foldersCreated;
|
||||||
std::string sessionName;
|
std::string sessionName;
|
||||||
|
|
|
@ -105,8 +105,8 @@ void AudioEditor::show( AudioBuffer* buf, bool modal )
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<float>& tmp = ab->getDataL();
|
std::vector<float>& tmp = ab->getDataL();
|
||||||
int size = tmp.size();
|
const auto size = tmp.size();
|
||||||
waveform->setData( &tmp[0], size );
|
waveform->setData( tmp );
|
||||||
|
|
||||||
const int beats[]= {1,2,4,8,16,32,64};
|
const int beats[]= {1,2,4,8,16,32,64};
|
||||||
|
|
||||||
|
|
|
@ -263,7 +263,7 @@ void GMasterTrack::setBpm( int b )
|
||||||
tempoDial.value( ( bpm - 60 ) / 160.f );
|
tempoDial.value( ( bpm - 60 ) / 160.f );
|
||||||
std::stringstream s;
|
std::stringstream s;
|
||||||
s << bpm;
|
s << bpm;
|
||||||
tempoDial.setLabel( s.str().c_str() );
|
tempoDial.copy_label( s.str().c_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMasterTrack::setInputVol(float f)
|
void GMasterTrack::setInputVol(float f)
|
||||||
|
|
12
src/gui.cxx
12
src/gui.cxx
|
@ -442,7 +442,7 @@ Gui::Gui(const char* argZero) :
|
||||||
for (; i < NTRACKS; i++ ) {
|
for (; i < NTRACKS; i++ ) {
|
||||||
stringstream s;
|
stringstream s;
|
||||||
s << "Track " << i+1;
|
s << "Track " << i+1;
|
||||||
tracks.push_back( new GTrack(8 + i * 118, 40, 110, 650, s.str().c_str() ) );
|
tracks.push_back( std::make_shared<GTrack>(8 + i * 118, 40, 110, 650, s.str().c_str() ) );
|
||||||
}
|
}
|
||||||
master = new GMasterTrack(8 + i * 118, 40, 150, 650, "Master");
|
master = new GMasterTrack(8 + i * 118, 40, 150, 650, "Master");
|
||||||
}
|
}
|
||||||
|
@ -515,7 +515,7 @@ void Gui::reset()
|
||||||
for(unsigned int i = 0; i < NTRACKS; i++) {
|
for(unsigned int i = 0; i < NTRACKS; i++) {
|
||||||
stringstream s;
|
stringstream s;
|
||||||
s << "Track " << i+1;
|
s << "Track " << i+1;
|
||||||
tracks.at(i)->bg.setLabel( s.str().c_str() );
|
tracks.at(i)->bg.copy_label( s.str().c_str() );
|
||||||
|
|
||||||
for(unsigned int s = 0; s < NSCENES; s++) {
|
for(unsigned int s = 0; s < NSCENES; s++) {
|
||||||
tracks.at(i)->getClipSelector()->clipName( s, "" );
|
tracks.at(i)->getClipSelector()->clipName( s, "" );
|
||||||
|
@ -530,7 +530,7 @@ void Gui::reset()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GTrack* Gui::getTrack(int id)
|
std::shared_ptr<GTrack> Gui::getTrack(int id) const
|
||||||
{
|
{
|
||||||
return tracks.at(id);
|
return tracks.at(id);
|
||||||
}
|
}
|
||||||
|
@ -915,10 +915,4 @@ Gui::~Gui()
|
||||||
delete diskWriter;
|
delete diskWriter;
|
||||||
|
|
||||||
delete master;
|
delete master;
|
||||||
|
|
||||||
for(unsigned int i = 0; i < tracks.size(); i++) {
|
|
||||||
delete tracks.at(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include <FL/Fl.H>
|
#include <FL/Fl.H>
|
||||||
#include <FL/Fl_Double_Window.H>
|
#include <FL/Fl_Double_Window.H>
|
||||||
|
@ -68,7 +69,7 @@ public:
|
||||||
void addMidiControllerToSetup(std::string);
|
void addMidiControllerToSetup(std::string);
|
||||||
void setupMidiControllers();
|
void setupMidiControllers();
|
||||||
|
|
||||||
GTrack* getTrack(int id);
|
std::shared_ptr<GTrack> getTrack(int id) const;
|
||||||
GMasterTrack* getMasterTrack()
|
GMasterTrack* getMasterTrack()
|
||||||
{
|
{
|
||||||
return master;
|
return master;
|
||||||
|
@ -137,7 +138,7 @@ private:
|
||||||
|
|
||||||
GMasterTrack* master;
|
GMasterTrack* master;
|
||||||
|
|
||||||
vector<GTrack*> tracks;
|
vector<std::shared_ptr<GTrack>> tracks;
|
||||||
|
|
||||||
// FIXME: refactor tooltip code out..?
|
// FIXME: refactor tooltip code out..?
|
||||||
std::string tooltip;
|
std::string tooltip;
|
||||||
|
|
|
@ -39,8 +39,8 @@ jack_ringbuffer_t* rbToDsp = 0;
|
||||||
jack_ringbuffer_t* rbToGui = 0;
|
jack_ringbuffer_t* rbToGui = 0;
|
||||||
|
|
||||||
// global static pointers, for access from EventHandlerGui and EventHandlerDsp
|
// global static pointers, for access from EventHandlerGui and EventHandlerDsp
|
||||||
Gui * gui = 0;
|
Gui * gui = nullptr;
|
||||||
Jack* jack = 0;
|
Jack* jack = nullptr;
|
||||||
|
|
||||||
|
|
||||||
void signalHanlder(int signum)
|
void signalHanlder(int signum)
|
||||||
|
@ -130,6 +130,7 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
gui->show();
|
gui->show();
|
||||||
|
|
||||||
|
delete gui;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue