Skip to content

Commit

Permalink
Did a quick port of this very old project I had to GTKmm,
Browse files Browse the repository at this point in the history
with hope of some day completing it.
I miss writing music and can't really use sequencers..
  • Loading branch information
reduz committed May 5, 2018
1 parent ea2498e commit c8967ce
Show file tree
Hide file tree
Showing 61 changed files with 9,074 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,8 @@
*.exe
*.out
*.app

*.config
*.include
*.creator*
*.files
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
all:
scons
37 changes: 37 additions & 0 deletions SConstruct
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

EnsureSConsVersion(0,14);

env = Environment(CPPPATH=['#/globals','#gui','#.'])

env.ParseConfig("pkg-config gtkmm-3.0 --libs --cflags")
env.Append(CXXFLAGS=["-g3"])

def add_sources(self, sources, filetype, lib_env = None, shared = False):
import glob;
import string;
#if not lib_objects:
if not lib_env:
lib_env = self
if type(filetype) == type(""):

dir = self.Dir('.').abspath
list = glob.glob(dir + "/"+filetype)
for f in list:
sources.append( self.Object(f) )
else:
for f in filetype:
sources.append(self.Object(f))


env.__class__.add_sources=add_sources


Export('env')

env.libs=[]

SConscript('globals/SCsub');
SConscript('engine/SCsub');
SConscript('gui/SCsub');
SConscript('bin/SCsub');

10 changes: 10 additions & 0 deletions bin/SCsub
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Import('env')


ctfiles=['sytrax.cpp'];

env.Append(LINKFLAGS=["-Wl,--start-group"])
env.Append(LIBS=env.libs)
env.Program('sytrax', ctfiles);


12 changes: 12 additions & 0 deletions bin/sytrax.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include <gtkmm.h>

#include "gui/interface.h"

int main(int argc, char *argv[]) {
auto app = Gtk::Application::create(argc, argv, "org.gtkmm.examples.base");

Interface window;
window.set_default_size(800, 600);

return app->run(window);
}
154 changes: 154 additions & 0 deletions dsp/event.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
#ifndef EVENT_H
#define EVENT_H



enum CC {

CC_BANK_SELECT_MSB=0,
CC_MODULATION=1,
CC_BREATH=2,
CC_FOOT=4,
CC_PORTAMENTO_TIME=5,
CC_DATA_ENTRY_MSB=6,
CC_MAIN_VOLUME=7,
CC_PAN=10,
CC_EXPRESSION=11,
CC_BANK_SELECT_LSB=32,
CC_DATA_ENTRY_LSB=38,
CC_DAMPER_PEDAL_TOGGLE=64,
CC_PORTAMENTO_TOGGLE=65,
CC_SOSTENUTO_TOGGLE=66,
CC_SOFT_PEDAL_TOGGLE=67,
CC_FILTER_CUTOFF=71,
CC_RELEASE_TIME=72,
CC_ATTACK_TIME=73,
CC_FILTER_RESONANCE=74,
CC_DECAY_TIME=75,
CC_VIBRATO_DEPTH=76,
CC_VIBRATO_RATE=77,
CC_VIBRATO_DELAY=78,
CC_PORTAMENTO_CONTROL=84,
CC_REVERB_SEND=91,
CC_FX2_SEND=92,
CC_CHORUS_SEND=93,
CC_FX4_SEND=94,
CC_DATA_INCREMENT=96,
CC_DATA_DECREMENT=97,
CC_NRPN_LSB=98,
CC_NRPN_MSB=99,
CC_RPN_LSB=98,
CC_RPN_MSB=99,
CC_ALL_SOUNDS_OFF_CMD=120,
CC_RESET_ALL_CC_CMD=121,
CC_LOCAL_CTRL_TOGGLE=122,
CC_ALL_NOTES_OFF=123,
CC_MAX=128

};


struct Event {
public:

enum Type {

NONE=0x0,
SEQ_TEMPO=0x1,
SEQ_SIGNATURE=0x2,
SEQ_BAR=0x3,
SEQ_BEAT=0x4,
SEQ_SCALE=0x5,
STREAM_TAIL=0x7, // end of stream, for stream buffers
MIDI_NOTE_OFF=0x8,
MIDI_NOTE_ON=0x9,
MIDI_NOTE_PRESSURE=0xA,
MIDI_CONTROLLER=0xB,
MIDI_PATCH_SELECT=0xC,
MIDI_AFTERTOUCH=0xD, //channel pressure
MIDI_PITCH_BEND=0xE,
MIDI_SYSEX=0xF, //this will not be used here for now anway
};

unsigned int frame;

unsigned char type;
unsigned char channel; // 0 - 15

union {

struct {
unsigned char param1;
unsigned char param2;
} raw;
struct { /* raw, 2 bytes */
unsigned short param;
} raw2;

struct { /* Note On / Note Off / Note Pressure */

unsigned char note;
unsigned char velocity;
} note;

struct { /* Controller */

unsigned char index;
unsigned char parameter;
} control;

struct { /* Channel Pressure */

unsigned char pressure;
} aftertouch;

struct { /* Patch */

unsigned char index;
} patch;

struct { /* Pitch Bend */

unsigned short bend; /* 0 - 0x3999 */
} pitch_bend;

struct {

unsigned short tempo;
} tempo;

struct {

unsigned char num;
unsigned char denom;
} signature;

struct {

unsigned short bar; // warning, max is 65535, It's a high number but may roll around
} bar;
struct {

unsigned char beat;
} beat;
struct {

enum ScaleType {
SCALE_MAJOR,
SCALE_MINOR,
/* Will have add more later */
};

unsigned char scale_type;
char key_note; /* 0 .. 11 */
} scale;

};

Event();
Event(Type p_type, unsigned char p_chan,unsigned char data1, unsigned char data2 );

~Event();

};
#endif // EVENT_H
51 changes: 51 additions & 0 deletions dsp/frame.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#ifndef AudioFrame_H
#define AudioFrame_H

#include "typedefs.h"
typedef float AudioFrame;

struct AudioFrame2 {

AudioFrame l,r;


_FORCE_INLINE_ const AudioFrame& operator[](int idx) const { return idx==0?l:r; }
_FORCE_INLINE_ AudioFrame& operator[](int idx) { return idx==0?l:r; }
_FORCE_INLINE_ AudioFrame2 operator+(const AudioFrame2& p_AudioFrame2) const { return AudioFrame2(l+p_AudioFrame2.l,r+p_AudioFrame2.r); }
_FORCE_INLINE_ AudioFrame2 operator-(const AudioFrame2& p_AudioFrame2) const { return AudioFrame2(l-p_AudioFrame2.l,r-p_AudioFrame2.r); }
_FORCE_INLINE_ AudioFrame2 operator*(const AudioFrame2& p_AudioFrame2) const { return AudioFrame2(l*p_AudioFrame2.l,r*p_AudioFrame2.r); }
_FORCE_INLINE_ AudioFrame2 operator/(const AudioFrame2& p_AudioFrame2) const { return AudioFrame2(l/p_AudioFrame2.l,r/p_AudioFrame2.r); }

_FORCE_INLINE_ void operator+=(const AudioFrame2& p_AudioFrame2) { l+=p_AudioFrame2.l;r+=p_AudioFrame2.r; }
_FORCE_INLINE_ void operator-=(const AudioFrame2& p_AudioFrame2) { l-=p_AudioFrame2.l;r-=p_AudioFrame2.r; }
_FORCE_INLINE_ void operator*=(const AudioFrame2& p_AudioFrame2) { l*=p_AudioFrame2.l;r*=p_AudioFrame2.r; }
_FORCE_INLINE_ void operator/=(const AudioFrame2& p_AudioFrame2) { l/=p_AudioFrame2.l;r/=p_AudioFrame2.r; }

_FORCE_INLINE_ AudioFrame2 operator+(const AudioFrame& p_AudioFrame) const { return AudioFrame2(l+p_AudioFrame,r+p_AudioFrame); }
_FORCE_INLINE_ AudioFrame2 operator-(const AudioFrame& p_AudioFrame) const { return AudioFrame2(l-p_AudioFrame,r-p_AudioFrame); }
_FORCE_INLINE_ AudioFrame2 operator*(const AudioFrame& p_AudioFrame) const { return AudioFrame2(l*p_AudioFrame,r*p_AudioFrame); }
_FORCE_INLINE_ AudioFrame2 operator/(const AudioFrame& p_AudioFrame) const { return AudioFrame2(l/p_AudioFrame,r/p_AudioFrame); }

_FORCE_INLINE_ void operator+=(const AudioFrame& p_AudioFrame) { l+=p_AudioFrame; r+=p_AudioFrame; }
_FORCE_INLINE_ void operator-=(const AudioFrame& p_AudioFrame) { l-=p_AudioFrame; r-=p_AudioFrame; }
_FORCE_INLINE_ void operator*=(const AudioFrame& p_AudioFrame) { l*=p_AudioFrame; r*=p_AudioFrame; }
_FORCE_INLINE_ void operator/=(const AudioFrame& p_AudioFrame) { l/=p_AudioFrame; r/=p_AudioFrame; }

_FORCE_INLINE_ AudioFrame2(AudioFrame p_l, AudioFrame p_r) {l=p_l; r=p_r;}
_FORCE_INLINE_ AudioFrame2(AudioFrame p_AudioFrame) {l=p_AudioFrame; r=p_AudioFrame;}
_FORCE_INLINE_ AudioFrame2() {}

} _FORCE_ALIGN_;

typedef AudioFrame2 StereoAudioFrame;

enum AudioFrameType {

AUDIO_FRAME_MONO,
AUDIO_FRAME_STEREO
};




#endif // AudioFrame_H
8 changes: 8 additions & 0 deletions engine/SCsub
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Import('env');
Export('env');

targets=[]

env.add_sources(targets,"*.cpp")

env.libs+=env.Library('engine', targets);
55 changes: 55 additions & 0 deletions engine/audio_effect.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#include "audio_effect.h"




void ControlPort::set_normalized(float p_val,bool p_make_initial) {

p_val*=get_max()-get_min();
p_val+=get_min();
set(p_val,p_make_initial);

}

float ControlPort::get_normalized() const {

float v=get();
v-=get_min();
v/=get_max()-get_min();
return v;
}

String ControlPort::convert_value_to_text(float p_value) const {

return String::num(p_value);
}

String ControlPort::get_value_as_text() const {

return convert_value_to_text(get());
}

ControlPort::Hint ControlPort::get_hint() const {

return HINT_RANGE;
}

ControlPort::ControlPort() {


}
ControlPort::~ControlPort() {

}

const ControlPort* AudioEffect::get_control_port(int p_idx) const {

return const_cast<AudioEffect*>(this)->get_control_port(p_idx);
}
AudioEffect::AudioEffect()
{
}

AudioEffect::~AudioEffect()
{
}
Loading

0 comments on commit c8967ce

Please sign in to comment.