many changes, mostly to export
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
#include "effects/effects.h"
|
||||
|
||||
#include "project/clip.h"
|
||||
|
||||
#include <QVector>
|
||||
#include <QDebug>
|
||||
|
||||
QVector<QString> video_effect_names;
|
||||
QVector<QString> audio_effect_names;
|
||||
@@ -14,3 +17,18 @@ void init_effects() {
|
||||
audio_effect_names[AUDIO_VOLUME_EFFECT] = "Volume";
|
||||
audio_effect_names[AUDIO_PAN_EFFECT] = "Pan";
|
||||
}
|
||||
|
||||
Effect* create_effect(int effect_id, Clip* c) {
|
||||
if (c->track < 0) {
|
||||
switch (effect_id) {
|
||||
case VIDEO_TRANSFORM_EFFECT: return new TransformEffect(c);
|
||||
}
|
||||
} else {
|
||||
switch (effect_id) {
|
||||
case AUDIO_VOLUME_EFFECT: return new VolumeEffect(c);
|
||||
case AUDIO_PAN_EFFECT: return new PanEffect(c);
|
||||
}
|
||||
}
|
||||
qDebug() << "[ERROR] Invalid effect ID";
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+12
-8
@@ -20,14 +20,16 @@ enum AudioEffects {
|
||||
extern QVector<QString> video_effect_names;
|
||||
extern QVector<QString> audio_effect_names;
|
||||
void init_effects();
|
||||
Effect* create_effect(int effect_id, Clip* c);
|
||||
|
||||
// video effects
|
||||
class TransformEffect : public Effect {
|
||||
Q_OBJECT
|
||||
public:
|
||||
TransformEffect(Clip* c);
|
||||
TransformEffect(Clip* c);
|
||||
void process_gl(int* anchor_x, int* anchor_y);
|
||||
private:
|
||||
Effect* copy();
|
||||
|
||||
QSpinBox* position_x;
|
||||
QSpinBox* position_y;
|
||||
QSpinBox* scale_x;
|
||||
@@ -44,17 +46,19 @@ public slots:
|
||||
// audio effects
|
||||
class VolumeEffect : public Effect {
|
||||
public:
|
||||
VolumeEffect(Clip* c);
|
||||
void process_audio(uint8_t* samples, int nb_bytes);
|
||||
private:
|
||||
VolumeEffect(Clip* c);
|
||||
void process_audio(uint8_t* samples, int nb_bytes);
|
||||
Effect* copy();
|
||||
|
||||
QSpinBox* volume_val;
|
||||
};
|
||||
|
||||
class PanEffect : public Effect {
|
||||
public:
|
||||
PanEffect(Clip* c);
|
||||
void process_audio(uint8_t* samples, int nb_bytes);
|
||||
private:
|
||||
PanEffect(Clip* c);
|
||||
void process_audio(uint8_t* samples, int nb_bytes);
|
||||
Effect* copy();
|
||||
|
||||
QSpinBox* pan_val;
|
||||
};
|
||||
|
||||
|
||||
@@ -28,6 +28,12 @@ PanEffect::PanEffect(Clip* c) : Effect(c) {
|
||||
pan_val->setValue(0);
|
||||
}
|
||||
|
||||
Effect* PanEffect::copy() {
|
||||
PanEffect* p = new PanEffect(parent_clip);
|
||||
p->pan_val->setValue(pan_val->value());
|
||||
return p;
|
||||
}
|
||||
|
||||
void PanEffect::process_audio(uint8_t *samples, int nb_bytes) {
|
||||
for (int i=0;i<nb_bytes;i+=4) {
|
||||
int16_t left_sample = (int16_t) ((samples[i+1] << 8) | samples[i]);
|
||||
|
||||
@@ -72,8 +72,8 @@ TransformEffect::TransformEffect(Clip* c) : Effect(c) {
|
||||
container->setContents(ui);
|
||||
|
||||
// set defaults
|
||||
position_x->setValue(c->sequence->width/2);
|
||||
position_y->setValue(c->sequence->height/2);
|
||||
position_x->setValue(c->sequence->width/2);
|
||||
position_y->setValue(c->sequence->height/2);
|
||||
scale_x->setValue(100);
|
||||
scale_y->setValue(100);
|
||||
scale_y->setEnabled(false);
|
||||
@@ -94,6 +94,20 @@ TransformEffect::TransformEffect(Clip* c) : Effect(c) {
|
||||
connect(uniform_scale_box, SIGNAL(toggled(bool)), this, SLOT(field_changed()));
|
||||
}
|
||||
|
||||
Effect* TransformEffect::copy() {
|
||||
TransformEffect* t = new TransformEffect(parent_clip);
|
||||
t->position_x->setValue(position_x->value());
|
||||
t->position_y->setValue(position_y->value());
|
||||
t->scale_x->setValue(scale_x->value());
|
||||
t->scale_y->setValue(scale_y->value());
|
||||
t->uniform_scale_box->setChecked(uniform_scale_box->isChecked());
|
||||
t->rotation->setValue(rotation->value());
|
||||
t->anchor_x_box->setValue(anchor_x_box->value());
|
||||
t->anchor_y_box->setValue(anchor_y_box->value());
|
||||
t->opacity->setValue(opacity->value());
|
||||
return t;
|
||||
}
|
||||
|
||||
void TransformEffect::toggle_uniform_scale(bool enabled) {
|
||||
scale_y->setEnabled(!enabled);
|
||||
}
|
||||
|
||||
@@ -28,6 +28,12 @@ VolumeEffect::VolumeEffect(Clip* c) : Effect(c) {
|
||||
volume_val->setValue(100);
|
||||
}
|
||||
|
||||
Effect* VolumeEffect::copy() {
|
||||
VolumeEffect* v = new VolumeEffect(parent_clip);
|
||||
v->volume_val->setValue(volume_val->value());
|
||||
return v;
|
||||
}
|
||||
|
||||
void VolumeEffect::process_audio(uint8_t *samples, int nb_bytes) {
|
||||
for (int i=0;i<nb_bytes;i+=2) {
|
||||
int16_t full_sample = (int16_t) ((samples[i+1] << 8) | samples[i]);
|
||||
|
||||
Reference in New Issue
Block a user