xiRetimer

fit recorded audio to a tempo
git clone https://git.ce9e.org/xiRetimer.git

commit
5d7c2e5dd8d4d04a89290ba3ac6f47b3a66d5abb
parent
bfc5f4878b16802da2f9d8c020fc19fc5d8f714c
Author
Tobias Bengfort <tobias.bengfort@gmx.net>
Date
2010-11-21 20:57
Prefs showInt

Diffstat

M src/curve.cpp 6 +-----
M src/curve.h 16 +---------------
M src/gui/RetimerMainFrame.cpp 4 ++--
M src/gui/RetimerPrefsDialog.cpp 7 +++++++
M src/gui/RetimerPrefsDialog.h 2 ++
M src/gui/retimer_wx.cpp 8 ++++++++
M src/gui/retimer_wx.cpp.in 8 ++++++++
M src/gui/retimer_wx.fbp 113 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
M src/gui/retimer_wx.h 4 ++++
M src/intmode_poly.h 1 -
M src/sample.cpp 5 ++---
M xiRetimer 0

12 files changed, 147 insertions, 27 deletions


diff --git a/src/curve.cpp b/src/curve.cpp

@@ -7,6 +7,7 @@ Curve::Curve(Marker* m, Sample* s, Playback* p) {
    7     7   tempo=90;
    8     8   selMarker=-1;
    9     9   beatResolution=1;
   -1    10   _showIntLine=false;
   10    11 }
   11    12 
   12    13 Curve::~Curve() {
@@ -82,8 +83,3 @@ float Curve::getMarker(int i) {return marker->new2nnew(marker->getNew(i));}
   82    83 
   83    84 void Curve::clearMarker() {marker->reset();}
   84    85 
   85    -1 bool Curve::showIntLine() {
   86    -1   // TODO showIntLine
   87    -1   return true;
   88    -1 }
   89    -1 

diff --git a/src/curve.h b/src/curve.h

@@ -32,7 +32,7 @@ public:
   32    32   float getBeatResolution();
   33    33   void setTempo(int bpm);
   34    34   int getTempo();
   35    -1   bool showIntLine();
   -1    35   bool _showIntLine;
   36    36 private:
   37    37   Marker* marker;
   38    38   Sample* sample;
@@ -42,18 +42,4 @@ private:
   42    42   float beatResolution;
   43    43 };
   44    44 
   45    -1 /*
   46    -1 int main() {
   47    -1   Marker* m=new Marker();
   48    -1   Sample* s=new Sample(m);
   49    -1   m->add(0.5,0.3);
   50    -1   int error;
   51    -1   error=s->loadFile("../../test.wav");
   52    -1   
   53    -1   Curve c(s);
   54    -1   c.setScreenWidth(100);
   55    -1   c.print();
   56    -1 }
   57    -1 */
   58    -1 
   59    45 #endif

diff --git a/src/gui/RetimerMainFrame.cpp b/src/gui/RetimerMainFrame.cpp

@@ -190,7 +190,7 @@ void RetimerMainFrame::paint(wxDC* dc) {
  190   190       float max=1+curve->getMax(i/(float)width, 1/(float)width);
  191   191       mdc.DrawLine(i,int(min*height/2),i,int(max*height/2));
  192   192     }
  193    -1     if (curve->showIntLine()) {
   -1   193     if (curve->_showIntLine) {
  194   194       mdc.SetPen(*penCurve2);
  195   195       float x1;
  196   196       float x2=marker->new2nnew(marker->old2new(0));
@@ -246,7 +246,7 @@ void RetimerMainFrame::process() {
  246   246       dialog->Update(int(sample->getFinished()*100));
  247   247     }
  248   248     dialog->Show(false);
  249    -1     // TODO deatroy dialog
   -1   249     // TODO destroy dialog
  250   250 }
  251   251 
  252   252 void RetimerMainFrame::reportError(wxString string) {

diff --git a/src/gui/RetimerPrefsDialog.cpp b/src/gui/RetimerPrefsDialog.cpp

@@ -7,11 +7,13 @@ RetimerPrefsDialog::RetimerPrefsDialog(Marker* m, Sample* s, Curve* c) : PrefsDi
    7     7   curve=c;
    8     8   
    9     9   oldInterpolationMode=marker->getInterpolationMode();
   -1    10   oldShowIntLine=curve->_showIntLine;
   10    11   oldStretchMode=sample->getStretchMode();
   11    12   oldTempo=curve->getTempo();
   12    13   oldBeatResolution=curve->getBeatResolution();
   13    14 
   14    15   c_intmode->SetSelection(oldInterpolationMode);
   -1    16   m_showint->SetValue(oldShowIntLine);
   15    17   c_stretchmode->SetSelection(oldStretchMode);
   16    18 
   17    19   wxString wxs4;
@@ -27,6 +29,10 @@ void RetimerPrefsDialog::OnIntModeChange( wxCommandEvent& event ) {
   27    29   marker->setInterpolationMode(c_intmode->GetSelection());
   28    30 }
   29    31 
   -1    32 void RetimerPrefsDialog::OnCheckShowInt( wxCommandEvent& event ) {
   -1    33   curve->_showIntLine=m_showint->GetValue();
   -1    34 }
   -1    35 
   30    36 void RetimerPrefsDialog::OnStretchModeChange( wxCommandEvent& event ) {
   31    37   sample->setStretchMode(c_stretchmode->GetSelection());
   32    38 }
@@ -53,6 +59,7 @@ void RetimerPrefsDialog::OnOKClick( wxCommandEvent& event ) {
   53    59 
   54    60 void RetimerPrefsDialog::OnCancelClick( wxCommandEvent& event ) {
   55    61   marker->setInterpolationMode(oldInterpolationMode);
   -1    62   curve->_showIntLine=oldShowIntLine;
   56    63   sample->setStretchMode(oldStretchMode);
   57    64   curve->setTempo(oldTempo);
   58    65   curve->setBeatResolution(oldBeatResolution);

diff --git a/src/gui/RetimerPrefsDialog.h b/src/gui/RetimerPrefsDialog.h

@@ -19,6 +19,7 @@ class RetimerPrefsDialog : public PrefsDialog
   19    19 protected:
   20    20 	// Handlers for PrefsDialog events.
   21    21 	void OnIntModeChange( wxCommandEvent& event );
   -1    22 	void OnCheckShowInt( wxCommandEvent& event );
   22    23 	void OnStretchModeChange( wxCommandEvent& event );
   23    24 	void OnTempoEnter( wxCommandEvent& event );
   24    25 	void OnBeatResEnter( wxCommandEvent& event );
@@ -26,6 +27,7 @@ protected:
   26    27 	void OnCancelClick( wxCommandEvent& event );
   27    28 
   28    29   int oldInterpolationMode;
   -1    30   bool oldShowIntLine;
   29    31   int oldStretchMode;
   30    32   int oldTempo;
   31    33   float oldBeatResolution;

diff --git a/src/gui/retimer_wx.cpp b/src/gui/retimer_wx.cpp

@@ -212,6 +212,13 @@ PrefsDialog::PrefsDialog( wxWindow* parent, wxWindowID id, const wxString& title
  212   212 	c_intmode->SetSelection( 0 );
  213   213 	fgSizer4->Add( c_intmode, 1, wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
  214   214 	
   -1   215 	l_showint = new wxStaticText( this, wxID_ANY, wxT("show interpolation curve"), wxDefaultPosition, wxDefaultSize, 0 );
   -1   216 	l_showint->Wrap( -1 );
   -1   217 	fgSizer4->Add( l_showint, 0, wxALL, 5 );
   -1   218 	
   -1   219 	m_showint = new wxCheckBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
   -1   220 	fgSizer4->Add( m_showint, 0, wxALL, 5 );
   -1   221 
  215   222 	l_stretchmode = new wxStaticText( this, wxID_ANY, wxT("Stretch Mode"), wxDefaultPosition, wxDefaultSize, 0 );
  216   223 	l_stretchmode->Wrap( -1 );
  217   224 	fgSizer4->Add( l_stretchmode, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
@@ -262,6 +269,7 @@ PrefsDialog::PrefsDialog( wxWindow* parent, wxWindowID id, const wxString& title
  262   269 	
  263   270 	// Connect Events
  264   271 	c_intmode->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PrefsDialog::OnIntModeChange ), NULL, this );
   -1   272 	m_showint->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PrefsDialog::OnCheckShowInt ), NULL, this );
  265   273 	c_stretchmode->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PrefsDialog::OnStretchModeChange ), NULL, this );
  266   274 	t_tempo->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( PrefsDialog::OnTempoEnter ), NULL, this );
  267   275 	t_beatres->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( PrefsDialog::OnBeatResEnter ), NULL, this );

diff --git a/src/gui/retimer_wx.cpp.in b/src/gui/retimer_wx.cpp.in

@@ -212,6 +212,13 @@ PrefsDialog::PrefsDialog( wxWindow* parent, wxWindowID id, const wxString& title
  212   212 	c_intmode->SetSelection( 0 );
  213   213 	fgSizer4->Add( c_intmode, 1, wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
  214   214 	
   -1   215 	l_showint = new wxStaticText( this, wxID_ANY, wxT("show interpolation curve"), wxDefaultPosition, wxDefaultSize, 0 );
   -1   216 	l_showint->Wrap( -1 );
   -1   217 	fgSizer4->Add( l_showint, 0, wxALL, 5 );
   -1   218 	
   -1   219 	m_showint = new wxCheckBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
   -1   220 	fgSizer4->Add( m_showint, 0, wxALL, 5 );
   -1   221 
  215   222 	l_stretchmode = new wxStaticText( this, wxID_ANY, wxT("Stretch Mode"), wxDefaultPosition, wxDefaultSize, 0 );
  216   223 	l_stretchmode->Wrap( -1 );
  217   224 	fgSizer4->Add( l_stretchmode, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
@@ -262,6 +269,7 @@ PrefsDialog::PrefsDialog( wxWindow* parent, wxWindowID id, const wxString& title
  262   269 	
  263   270 	// Connect Events
  264   271 	c_intmode->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PrefsDialog::OnIntModeChange ), NULL, this );
   -1   272 	m_showint->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PrefsDialog::OnCheckShowInt ), NULL, this );
  265   273 	c_stretchmode->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PrefsDialog::OnStretchModeChange ), NULL, this );
  266   274 	t_tempo->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( PrefsDialog::OnTempoEnter ), NULL, this );
  267   275 	t_beatres->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( PrefsDialog::OnBeatResEnter ), NULL, this );

diff --git a/src/gui/retimer_wx.fbp b/src/gui/retimer_wx.fbp

@@ -648,7 +648,7 @@
  648   648                 </object>
  649   649             </object>
  650   650         </object>
  651    -1         <object class="Dialog" expanded="0">
   -1   651         <object class="Dialog" expanded="1">
  652   652             <property name="bg"></property>
  653   653             <property name="center"></property>
  654   654             <property name="context_help"></property>
@@ -837,6 +837,117 @@
  837   837                         </object>
  838   838                         <object class="sizeritem" expanded="1">
  839   839                             <property name="border">5</property>
   -1   840                             <property name="flag">wxALL</property>
   -1   841                             <property name="proportion">0</property>
   -1   842                             <object class="wxStaticText" expanded="1">
   -1   843                                 <property name="bg"></property>
   -1   844                                 <property name="context_help"></property>
   -1   845                                 <property name="enabled">1</property>
   -1   846                                 <property name="fg"></property>
   -1   847                                 <property name="font"></property>
   -1   848                                 <property name="hidden">0</property>
   -1   849                                 <property name="id">wxID_ANY</property>
   -1   850                                 <property name="label">show interpolation curve</property>
   -1   851                                 <property name="maximum_size"></property>
   -1   852                                 <property name="minimum_size"></property>
   -1   853                                 <property name="name">l_showint</property>
   -1   854                                 <property name="permission">protected</property>
   -1   855                                 <property name="pos"></property>
   -1   856                                 <property name="size"></property>
   -1   857                                 <property name="style"></property>
   -1   858                                 <property name="subclass"></property>
   -1   859                                 <property name="tooltip"></property>
   -1   860                                 <property name="validator_data_type"></property>
   -1   861                                 <property name="validator_style">wxFILTER_NONE</property>
   -1   862                                 <property name="validator_type">wxDefaultValidator</property>
   -1   863                                 <property name="validator_variable"></property>
   -1   864                                 <property name="window_extra_style"></property>
   -1   865                                 <property name="window_name"></property>
   -1   866                                 <property name="window_style"></property>
   -1   867                                 <property name="wrap">-1</property>
   -1   868                                 <event name="OnChar"></event>
   -1   869                                 <event name="OnEnterWindow"></event>
   -1   870                                 <event name="OnEraseBackground"></event>
   -1   871                                 <event name="OnKeyDown"></event>
   -1   872                                 <event name="OnKeyUp"></event>
   -1   873                                 <event name="OnKillFocus"></event>
   -1   874                                 <event name="OnLeaveWindow"></event>
   -1   875                                 <event name="OnLeftDClick"></event>
   -1   876                                 <event name="OnLeftDown"></event>
   -1   877                                 <event name="OnLeftUp"></event>
   -1   878                                 <event name="OnMiddleDClick"></event>
   -1   879                                 <event name="OnMiddleDown"></event>
   -1   880                                 <event name="OnMiddleUp"></event>
   -1   881                                 <event name="OnMotion"></event>
   -1   882                                 <event name="OnMouseEvents"></event>
   -1   883                                 <event name="OnMouseWheel"></event>
   -1   884                                 <event name="OnPaint"></event>
   -1   885                                 <event name="OnRightDClick"></event>
   -1   886                                 <event name="OnRightDown"></event>
   -1   887                                 <event name="OnRightUp"></event>
   -1   888                                 <event name="OnSetFocus"></event>
   -1   889                                 <event name="OnSize"></event>
   -1   890                                 <event name="OnUpdateUI"></event>
   -1   891                             </object>
   -1   892                         </object>
   -1   893                         <object class="sizeritem" expanded="1">
   -1   894                             <property name="border">5</property>
   -1   895                             <property name="flag">wxALL</property>
   -1   896                             <property name="proportion">0</property>
   -1   897                             <object class="wxCheckBox" expanded="1">
   -1   898                                 <property name="bg"></property>
   -1   899                                 <property name="checked">0</property>
   -1   900                                 <property name="context_help"></property>
   -1   901                                 <property name="enabled">1</property>
   -1   902                                 <property name="fg"></property>
   -1   903                                 <property name="font"></property>
   -1   904                                 <property name="hidden">0</property>
   -1   905                                 <property name="id">wxID_ANY</property>
   -1   906                                 <property name="label"></property>
   -1   907                                 <property name="maximum_size"></property>
   -1   908                                 <property name="minimum_size"></property>
   -1   909                                 <property name="name">m_showint</property>
   -1   910                                 <property name="permission">protected</property>
   -1   911                                 <property name="pos"></property>
   -1   912                                 <property name="size"></property>
   -1   913                                 <property name="style"></property>
   -1   914                                 <property name="subclass"></property>
   -1   915                                 <property name="tooltip"></property>
   -1   916                                 <property name="validator_data_type"></property>
   -1   917                                 <property name="validator_style">wxFILTER_NONE</property>
   -1   918                                 <property name="validator_type">wxDefaultValidator</property>
   -1   919                                 <property name="validator_variable"></property>
   -1   920                                 <property name="window_extra_style"></property>
   -1   921                                 <property name="window_name"></property>
   -1   922                                 <property name="window_style"></property>
   -1   923                                 <event name="OnChar"></event>
   -1   924                                 <event name="OnCheckBox">OnCheckShowInt</event>
   -1   925                                 <event name="OnEnterWindow"></event>
   -1   926                                 <event name="OnEraseBackground"></event>
   -1   927                                 <event name="OnKeyDown"></event>
   -1   928                                 <event name="OnKeyUp"></event>
   -1   929                                 <event name="OnKillFocus"></event>
   -1   930                                 <event name="OnLeaveWindow"></event>
   -1   931                                 <event name="OnLeftDClick"></event>
   -1   932                                 <event name="OnLeftDown"></event>
   -1   933                                 <event name="OnLeftUp"></event>
   -1   934                                 <event name="OnMiddleDClick"></event>
   -1   935                                 <event name="OnMiddleDown"></event>
   -1   936                                 <event name="OnMiddleUp"></event>
   -1   937                                 <event name="OnMotion"></event>
   -1   938                                 <event name="OnMouseEvents"></event>
   -1   939                                 <event name="OnMouseWheel"></event>
   -1   940                                 <event name="OnPaint"></event>
   -1   941                                 <event name="OnRightDClick"></event>
   -1   942                                 <event name="OnRightDown"></event>
   -1   943                                 <event name="OnRightUp"></event>
   -1   944                                 <event name="OnSetFocus"></event>
   -1   945                                 <event name="OnSize"></event>
   -1   946                                 <event name="OnUpdateUI"></event>
   -1   947                             </object>
   -1   948                         </object>
   -1   949                         <object class="sizeritem" expanded="1">
   -1   950                             <property name="border">5</property>
  840   951                             <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
  841   952                             <property name="proportion">0</property>
  842   953                             <object class="wxStaticText" expanded="1">

diff --git a/src/gui/retimer_wx.h b/src/gui/retimer_wx.h

@@ -24,6 +24,7 @@
   24    24 #include <wx/button.h>
   25    25 #include <wx/dialog.h>
   26    26 #include <wx/choice.h>
   -1    27 #include <wx/checkbox.h>
   27    28 #include <wx/textctrl.h>
   28    29 
   29    30 ///////////////////////////////////////////////////////////////////////////
@@ -102,6 +103,8 @@ class PrefsDialog : public wxDialog
  102   103 	protected:
  103   104 		wxStaticText* l_intmode;
  104   105 		wxChoice* c_intmode;
   -1   106 		wxStaticText* l_showint;
   -1   107 		wxCheckBox* m_showint;
  105   108 		wxStaticText* l_stretchmode;
  106   109 		wxChoice* c_stretchmode;
  107   110 		wxStaticText* l_tempo;
@@ -113,6 +116,7 @@ class PrefsDialog : public wxDialog
  113   116 		
  114   117 		// Virtual event handlers, overide them in your derived class
  115   118 		virtual void OnIntModeChange( wxCommandEvent& event ) { event.Skip(); }
   -1   119 		virtual void OnCheckShowInt( wxCommandEvent& event ) { event.Skip(); }
  116   120 		virtual void OnStretchModeChange( wxCommandEvent& event ) { event.Skip(); }
  117   121 		virtual void OnTempoEnter( wxCommandEvent& event ) { event.Skip(); }
  118   122 		virtual void OnBeatResEnter( wxCommandEvent& event ) { event.Skip(); }

diff --git a/src/intmode_poly.h b/src/intmode_poly.h

@@ -6,7 +6,6 @@
    6     6 
    7     7 /*
    8     8 This defines a interpolytion mode used in marker
    9    -1 // TODO lots of optimisation to do
   10     9 */
   11    10 
   12    11 namespace _IntPoly {

diff --git a/src/sample.cpp b/src/sample.cpp

@@ -45,7 +45,7 @@ void Sample::setStretchMode(int m) {
   45    45 }
   46    46 
   47    47 int Sample::loadFile(const char* fileName) {
   48    -1 // TODO multi filetype support
   -1    48 // TODO madliub/mp3 support
   49    49   if (_processing) return 1;
   50    50   SNDFILE *sndfile=NULL;
   51    51   sfinfo;
@@ -82,8 +82,7 @@ int Sample::loadFile(const char* fileName) {
   82    82   return process();
   83    83 }
   84    84 
   85    -1 int Sample::writeFile(const char* fileNameOut) {  
   86    -1 // TODO multi filetype support
   -1    85 int Sample::writeFile(const char* fileNameOut) {
   87    86   if (_processing) return 1;
   88    87   if (length<=0) {
   89    88     std::cerr << "ERROR: Load a file first" << std::endl;

diff --git a/xiRetimer b/xiRetimer

Binary files differ.