xiRetimer

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

commit
4a20eb83bddf2e2191fdf86aa8ccd6a740a16efd
parent
fd2e0480852bc8a66b6ec52fe8ca56d3215a1b0b
Author
xi <tobias.bengfort@gmx.net>
Date
2010-10-31 11:32
minor gui works

Diffstat

A gui/curve.cpp 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
A gui/curve.h 30 ++++++++++++++++++++++++++++++
M gui/make 1 +
D gui/xiRTFileSelectDialog.cpp 19 -------------------
D gui/xiRTFileSelectDialog.h 24 ------------------------
D gui/xiRTMainFrame.cp_ 42 ------------------------------------------
M gui/xiRTMainFrame.cpp 24 +++++++++++++++++-------
M gui/xiRTMainFrame.h 1 +
M gui/xiRetimer_wxfb.cpp 4 ++--

9 files changed, 102 insertions, 94 deletions


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

@@ -0,0 +1,51 @@
   -1     1 #include "curve.h"
   -1     2 
   -1     3 Curve::Curve() {
   -1     4   length=0;
   -1     5   start=0;
   -1     6   zoom=1;
   -1     7   datalength=100;
   -1     8 }
   -1     9 
   -1    10 Curve::~Curve() {}
   -1    11 
   -1    12 float Curve::get(int i) {
   -1    13   float data[100]; // data isnet implemented yet
   -1    14   int n=int(start*datalength+i*zoom*ZOOMFACTOR);
   -1    15   if (n>=0 && n<datalength)
   -1    16     return data[0];
   -1    17   else
   -1    18     return 0;
   -1    19 }
   -1    20 
   -1    21 bool Curve::selected(int i) {
   -1    22   int n=int(start*datalength+i*zoom*ZOOMFACTOR);
   -1    23   return (n>=starts*datalength && n<ends*datalength);
   -1    24 }
   -1    25 
   -1    26 void Curve::setZoom(float z) {
   -1    27   zoom=z;
   -1    28 }
   -1    29 
   -1    30 void Curve::zoomUp() {
   -1    31   setZoom(zoom*ZOOMSTEP);
   -1    32 }
   -1    33 
   -1    34 void Curve::zoomDown() {
   -1    35   setZoom(zoom/ZOOMSTEP);
   -1    36 }
   -1    37 
   -1    38 void Curve::zoomSel() {
   -1    39   start=starts;
   -1    40   setZoom((ends-starts)*datalength/length/ZOOMFACTOR);
   -1    41 }
   -1    42 
   -1    43 void Curve::zoomAll() {
   -1    44   start=0;
   -1    45   setZoom(datalength/ZOOMFACTOR/length);
   -1    46 }
   -1    47 
   -1    48 
   -1    49 void Curve::setlength(int l) {
   -1    50   length=l;
   -1    51 }

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

@@ -0,0 +1,30 @@
   -1     1 #ifndef __XICURVE_H
   -1     2 #define __XICURVE_H
   -1     3 
   -1     4 #include <iostream>
   -1     5 
   -1     6 class Curve {
   -1     7 public:
   -1     8   Curve(); // irgendwie muss ich das sample da rein bekommen
   -1     9   ~Curve();
   -1    10   float get(int i);
   -1    11   bool selected(int i);
   -1    12   void setZoom(float z);
   -1    13   void zoomUp();
   -1    14   void zoomDown();
   -1    15   void zoomSel();
   -1    16   void zoomAll();
   -1    17   void setlength(int l);
   -1    18 private:
   -1    19   float zoom;
   -1    20   int length;  // pixel
   -1    21   float start; // 0-1
   -1    22   float starts; //selection
   -1    23   float ends; //selection
   -1    24   int datalength;
   -1    25 protected:
   -1    26   static const float ZOOMFACTOR=1;
   -1    27   static const float ZOOMSTEP=1.2; // factor used by zoomUp and zoomDown
   -1    28 };
   -1    29 
   -1    30 #endif

diff --git a/gui/make b/gui/make

@@ -1 +1,2 @@
    1     1 g++ *.h *.cpp ../src/*.h ../src/*.cpp `wx-config --cxxflags --libs`
   -1     2 rm *.gch

diff --git a/gui/xiRTFileSelectDialog.cpp b/gui/xiRTFileSelectDialog.cpp

@@ -1,19 +0,0 @@
    1    -1 #include "xiRTFileSelectDialog.h"
    2    -1 
    3    -1 xiRTFileSelectDialog::xiRTFileSelectDialog( wxWindow* parent )
    4    -1 :
    5    -1 FileSelectDialog( parent )
    6    -1 {
    7    -1 
    8    -1 }
    9    -1 
   10    -1 void xiRTFileSelectDialog::OnOKClick( wxCommandEvent& event )
   11    -1 {
   12    -1 	// TODO: Implement OnOKClick
   13    -1         Close();
   14    -1 }
   15    -1 
   16    -1 void xiRTFileSelectDialog::OnCancelClick( wxCommandEvent& event )
   17    -1 {
   18    -1 	Close();
   19    -1 }

diff --git a/gui/xiRTFileSelectDialog.h b/gui/xiRTFileSelectDialog.h

@@ -1,24 +0,0 @@
    1    -1 #ifndef __xiRTFileSelectDialog__
    2    -1 #define __xiRTFileSelectDialog__
    3    -1 
    4    -1 /**
    5    -1 @file
    6    -1 Subclass of FileSelectDialog, which is generated by wxFormBuilder.
    7    -1 */
    8    -1 
    9    -1 #include "xiRetimer_wxfb.h"
   10    -1 
   11    -1 /** Implementing FileSelectDialog */
   12    -1 class xiRTFileSelectDialog : public FileSelectDialog
   13    -1 {
   14    -1 protected:
   15    -1 	// Handlers for FileSelectDialog events.
   16    -1 	void OnOKClick( wxCommandEvent& event );
   17    -1 	void OnCancelClick( wxCommandEvent& event );
   18    -1 	
   19    -1 public:
   20    -1 	/** Constructor */
   21    -1 	xiRTFileSelectDialog( wxWindow* parent );
   22    -1 };
   23    -1 
   24    -1 #endif // __xiRTFileSelectDialog__

diff --git a/gui/xiRTMainFrame.cp_ b/gui/xiRTMainFrame.cp_

@@ -1,42 +0,0 @@
    1    -1 #include "xiRTMainFrame.h"
    2    -1 #include "xiRTAboutDialog.h"
    3    -1 #include "xiRTPrefsDialog.h"
    4    -1 
    5    -1 xiRTMainFrame::xiRTMainFrame( wxWindow* parent )
    6    -1 :
    7    -1 MainFrame( parent )
    8    -1 {
    9    -1 
   10    -1 }
   11    -1 
   12    -1 void xiRTMainFrame::OnOpenClick( wxCommandEvent& event )
   13    -1 {
   14    -1 	// TODO: Implement OnOpenClick
   15    -1 }
   16    -1 
   17    -1 void xiRTMainFrame::OnExportClick( wxCommandEvent& event )
   18    -1 {
   19    -1 	// TODO: Implement OnExportClick
   20    -1 }
   21    -1 
   22    -1 void xiRTMainFrame::OnPrefsClick( wxCommandEvent& event )
   23    -1 {
   24    -1     xiRTPrefsDialog* dialog = new xiRTPrefsDialog( (wxWindow*)NULL );
   25    -1     dialog ->Show();
   26    -1 }
   27    -1 
   28    -1 void xiRTMainFrame::OnExitClick( wxCommandEvent& event )
   29    -1 {
   30    -1 	Close();
   31    -1 }
   32    -1 
   33    -1 void xiRTMainFrame::OnHelpClick( wxCommandEvent& event )
   34    -1 {
   35    -1 	// TODO: Implement OnHelpClick
   36    -1 }
   37    -1 
   38    -1 void xiRTMainFrame::OnAboutClick( wxCommandEvent& event )
   39    -1 {
   40    -1     xiRTAboutDialog* dialog = new xiRTAboutDialog( (wxWindow*)NULL );
   41    -1     dialog ->Show();
   42    -1 }

diff --git a/gui/xiRTMainFrame.cpp b/gui/xiRTMainFrame.cpp

@@ -1,25 +1,26 @@
    1     1 #include "xiRTMainFrame.h"
    2     2 #include "xiRTAboutDialog.h"
    3     3 #include "xiRTPrefsDialog.h"
    4    -1 #include "xiRTFileSelectDialog.h"
    5     4 
    6    -1 xiRTMainFrame::xiRTMainFrame( wxWindow* parent )
    7    -1 :
    8    -1 MainFrame( parent )
   -1     5 #include <wx/progdlg.h>
   -1     6 #include <wx/dcclient.h>
   -1     7 
   -1     8 xiRTMainFrame::xiRTMainFrame( wxWindow* parent ) : MainFrame( parent )
    9     9 {
   10    10 
   11    11 }
   12    12 
   13    13 void xiRTMainFrame::OnOpenClick( wxCommandEvent& event )
   14    14 {
   15    -1     xiRTFileSelectDialog* dialog = new xiRTFileSelectDialog( (wxWindow*)NULL );
   -1    15     wxFileDialog* dialog = new wxFileDialog( (wxWindow*)NULL );
   16    16     dialog ->Show();
   17    17 }
   18    18 
   19    19 void xiRTMainFrame::OnExportClick( wxCommandEvent& event )
   20    20 {
   21    -1     xiRTFileSelectDialog* dialog = new xiRTFileSelectDialog( (wxWindow*)NULL );
   -1    21     wxFileDialog* dialog = new wxFileDialog((wxWindow*)NULL, _T("Export As"), _T(""), _T(""), _T("*.*"), wxSAVE | wxOVERWRITE_PROMPT);
   22    22     dialog ->Show();
   -1    23     wxString path=dialog->GetPath();
   23    24 }
   24    25 
   25    26 void xiRTMainFrame::OnPrefsClick( wxCommandEvent& event )
@@ -30,12 +31,16 @@ void xiRTMainFrame::OnPrefsClick( wxCommandEvent& event )
   30    31 
   31    32 void xiRTMainFrame::OnExitClick( wxCommandEvent& event )
   32    33 {
   33    -1 	Close();
   -1    34 	Destroy();
   34    35 }
   35    36 
   36    37 void xiRTMainFrame::OnHelpClick( wxCommandEvent& event )
   37    38 {
   38    39 	// TODO: Implement OnHelpClick
   -1    40   wxClientDC dc(this);
   -1    41   wxBrush brush(*wxRED); // red pen of width 1
   -1    42   dc.SetBackground(brush);
   -1    43   dc.Clear();
   39    44 }
   40    45 
   41    46 void xiRTMainFrame::OnAboutClick( wxCommandEvent& event )
@@ -44,6 +49,11 @@ void xiRTMainFrame::OnAboutClick( wxCommandEvent& event )
   44    49     dialog ->Show();
   45    50 }
   46    51 
   -1    52 void xiRTMainFrame::OnProcessClick( wxCommandEvent& event ) {
   -1    53     wxProgressDialog::wxProgressDialog* dialog = new wxProgressDialog( _T("processing..."), _T("please wait") );
   -1    54     dialog ->Show();
   -1    55 }
   -1    56 
   47    57 void xiRTMainFrame::OnZUpClick( wxCommandEvent& event )
   48    58 {
   49    59 	// TODO: Implement OnZUpClick

diff --git a/gui/xiRTMainFrame.h b/gui/xiRTMainFrame.h

@@ -19,6 +19,7 @@ protected:
   19    19 	void OnExitClick( wxCommandEvent& event );
   20    20 	void OnHelpClick( wxCommandEvent& event );
   21    21 	void OnAboutClick( wxCommandEvent& event );
   -1    22   void OnProcessClick( wxCommandEvent& event );
   22    23 	void OnZUpClick( wxCommandEvent& event );
   23    24 	void OnZDownClick( wxCommandEvent& event );
   24    25 	void OnZFullClick( wxCommandEvent& event );

diff --git a/gui/xiRetimer_wxfb.cpp b/gui/xiRetimer_wxfb.cpp

@@ -18,11 +18,11 @@ MainFrame::MainFrame( wxWindow* parent, wxWindowID id, const wxString& title, co
   18    18 	
   19    19 	m_File = new wxMenu();
   20    20 	wxMenuItem* m_open;
   21    -1 	m_open = new wxMenuItem( m_File, wxID_ANY, wxString( wxT("open") ) , wxEmptyString, wxITEM_NORMAL );
   -1    21 	m_open = new wxMenuItem( m_File, wxID_ANY, wxString( wxT("&open") ) , wxEmptyString, wxITEM_NORMAL );
   22    22 	m_File->Append( m_open );
   23    23 	
   24    24 	wxMenuItem* m_export;
   25    -1 	m_export = new wxMenuItem( m_File, wxID_ANY, wxString( wxT("export") ) , wxEmptyString, wxITEM_NORMAL );
   -1    25 	m_export = new wxMenuItem( m_File, wxID_ANY, wxString( wxT("e&xport") ) , wxEmptyString, wxITEM_NORMAL );
   26    26 	m_File->Append( m_export );
   27    27 	
   28    28 	wxMenuItem* m_separator3;