mirror of
https://github.com/Ponce/slackbuilds
synced 2024-12-05 00:55:44 +01:00
6a87a41a89
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
156 lines
5.2 KiB
Diff
156 lines
5.2 KiB
Diff
diff -Naur stretchplayer-0.503/src/Engine.cpp stretchplayer-0.503.patched/src/Engine.cpp
|
|
--- stretchplayer-0.503/src/Engine.cpp 2010-07-18 00:44:20.000000000 -0400
|
|
+++ stretchplayer-0.503.patched/src/Engine.cpp 2014-02-28 17:43:36.000000000 -0500
|
|
@@ -46,6 +46,7 @@
|
|
_sample_rate(48000.0),
|
|
_stretch(1.0),
|
|
_pitch(0),
|
|
+ _fine(0),
|
|
_gain(1.0)
|
|
{
|
|
QString err;
|
|
@@ -153,7 +154,7 @@
|
|
uint32_t srate = _audio_system->sample_rate();
|
|
|
|
_stretcher->setTimeRatio( srate / _sample_rate / _stretch );
|
|
- _stretcher->setPitchScale( ::pow(2.0, double(_pitch)/12.0) * _sample_rate / srate );
|
|
+ _stretcher->setPitchScale( ::pow(2.0, double(_pitch)/12.0 + double(_fine)/1200.0) * _sample_rate / srate );
|
|
|
|
uint32_t frame;
|
|
uint32_t reqd, gend, zeros, feed;
|
|
diff -Naur stretchplayer-0.503/src/Engine.hpp stretchplayer-0.503.patched/src/Engine.hpp
|
|
--- stretchplayer-0.503/src/Engine.hpp 2010-07-18 00:44:20.000000000 -0400
|
|
+++ stretchplayer-0.503.patched/src/Engine.hpp 2014-03-01 11:26:57.000000000 -0500
|
|
@@ -81,6 +81,21 @@
|
|
//_state_changed = true;
|
|
}
|
|
|
|
+ int get_fine() {
|
|
+ return _fine;
|
|
+ }
|
|
+ void set_fine(int fin) {
|
|
+ if(fin < -99) {
|
|
+ _fine = fin % 100;
|
|
+ set_pitch(get_pitch() - 1);
|
|
+ } else if (fin > 99) {
|
|
+ _fine = fin % 100;
|
|
+ set_pitch(get_pitch() + 1);
|
|
+ } else {
|
|
+ _fine = fin;
|
|
+ }
|
|
+ }
|
|
+
|
|
/**
|
|
* Clipped to [0.0, 10.0]
|
|
*/
|
|
@@ -146,6 +161,7 @@
|
|
float _sample_rate;
|
|
float _stretch;
|
|
int _pitch;
|
|
+ int _fine;
|
|
float _gain;
|
|
std::auto_ptr<RubberBand::RubberBandStretcher> _stretcher;
|
|
std::auto_ptr<AudioSystem> _audio_system;
|
|
diff -Naur stretchplayer-0.503/src/PlayerWidget.cpp stretchplayer-0.503.patched/src/PlayerWidget.cpp
|
|
--- stretchplayer-0.503/src/PlayerWidget.cpp 2010-07-18 00:44:20.000000000 -0400
|
|
+++ stretchplayer-0.503.patched/src/PlayerWidget.cpp 2014-03-01 10:04:02.000000000 -0500
|
|
@@ -35,6 +35,7 @@
|
|
#include <QBitmap>
|
|
#include <QAction>
|
|
#include <QResizeEvent>
|
|
+#include <QApplication>
|
|
#include <QCoreApplication>
|
|
|
|
#include <cmath>
|
|
@@ -152,11 +153,21 @@
|
|
|
|
void PlayerWidget::pitch_inc()
|
|
{
|
|
+ if(QApplication::keyboardModifiers() == Qt::ShiftModifier)
|
|
+ _engine->set_fine( _engine->get_fine() + 10);
|
|
+ else if(QApplication::keyboardModifiers() == Qt::ControlModifier)
|
|
+ _engine->set_fine( _engine->get_fine() + 1);
|
|
+ else
|
|
_engine->set_pitch( _engine->get_pitch() + 1 );
|
|
}
|
|
|
|
void PlayerWidget::pitch_dec()
|
|
{
|
|
+ if(QApplication::keyboardModifiers() == Qt::ShiftModifier)
|
|
+ _engine->set_fine( _engine->get_fine() - 10);
|
|
+ else if(QApplication::keyboardModifiers() == Qt::ControlModifier)
|
|
+ _engine->set_fine( _engine->get_fine() - 1);
|
|
+ else
|
|
_engine->set_pitch( _engine->get_pitch() - 1);
|
|
}
|
|
|
|
@@ -262,8 +273,9 @@
|
|
float sch = _engine->get_stretch();
|
|
_status->speed(sch);
|
|
|
|
+ int fin = _engine->get_fine();
|
|
int pit = _engine->get_pitch();
|
|
- _status->pitch(pit);
|
|
+ _status->pitch(pit, fin);
|
|
|
|
float cpu = _engine->get_cpu_load();
|
|
_status->cpu(cpu);
|
|
@@ -471,8 +483,9 @@
|
|
QList<QKeySequence> inc_shortcuts;
|
|
inc_shortcuts << Qt::Key_Plus;
|
|
inc_shortcuts << Qt::Key_Equal;
|
|
+ inc_shortcuts << QKeySequence("Ctrl+=");
|
|
_act.pitch_inc = new QAction("+", this);
|
|
- _act.pitch_inc->setToolTip("Pitch Increase [+]");
|
|
+ _act.pitch_inc->setToolTip("Pitch Increase [+ or =] (Ctl/Shift=Fine)");
|
|
_act.pitch_inc->setShortcuts(inc_shortcuts);
|
|
_act.pitch_inc->setShortcutContext(Qt::ApplicationShortcut);
|
|
_act.pitch_inc->setIcon( _ico.plus );
|
|
@@ -480,9 +493,13 @@
|
|
connect(_act.pitch_inc, SIGNAL(triggered()),
|
|
this, SLOT(pitch_inc()));
|
|
|
|
+ QList<QKeySequence> dec_shortcuts;
|
|
+ dec_shortcuts << Qt::Key_Minus;
|
|
+ dec_shortcuts << Qt::Key_Underscore;
|
|
+ dec_shortcuts << QKeySequence("Ctrl+-");
|
|
_act.pitch_dec = new QAction("-", this);
|
|
- _act.pitch_dec->setToolTip("Pitch Decrease [-]");
|
|
- _act.pitch_dec->setShortcut(Qt::Key_Minus);
|
|
+ _act.pitch_dec->setToolTip("Pitch Decrease [-] (Ctl/Shift=Fine)");
|
|
+ _act.pitch_dec->setShortcuts(dec_shortcuts);
|
|
_act.pitch_dec->setShortcutContext(Qt::ApplicationShortcut);
|
|
_act.pitch_dec->setIcon( _ico.minus );
|
|
addAction(_act.pitch_dec);
|
|
diff -Naur stretchplayer-0.503/src/StatusWidget.cpp stretchplayer-0.503.patched/src/StatusWidget.cpp
|
|
--- stretchplayer-0.503/src/StatusWidget.cpp 2010-07-18 00:44:20.000000000 -0400
|
|
+++ stretchplayer-0.503.patched/src/StatusWidget.cpp 2014-03-01 11:16:47.000000000 -0500
|
|
@@ -85,10 +85,13 @@
|
|
.arg(val, 3, 'f', 0);
|
|
}
|
|
|
|
- void StatusWidget::pitch(int p)
|
|
+ void StatusWidget::pitch(int p, int f)
|
|
{
|
|
- _pitch = QString("PITCH: %1")
|
|
- .arg(int(p));
|
|
+ _pitch = QString("PITCH: %1").arg(int(p));
|
|
+ if(f > 0)
|
|
+ _pitch += QString("+%1").arg(int(f));
|
|
+ else if(f < 0)
|
|
+ _pitch += QString("%1").arg(int(f));
|
|
}
|
|
|
|
void StatusWidget::volume(float g)
|
|
diff -Naur stretchplayer-0.503/src/StatusWidget.hpp stretchplayer-0.503.patched/src/StatusWidget.hpp
|
|
--- stretchplayer-0.503/src/StatusWidget.hpp 2010-07-18 00:44:20.000000000 -0400
|
|
+++ stretchplayer-0.503.patched/src/StatusWidget.hpp 2014-02-28 19:20:49.000000000 -0500
|
|
@@ -54,7 +54,7 @@
|
|
void position(float);
|
|
void time(float);
|
|
void speed(float);
|
|
- void pitch(int);
|
|
+ void pitch(int, int);
|
|
void volume(float);
|
|
void cpu(float);
|
|
void message(QString);
|