xiRetimer

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

commit
40cc1a2061635889088450e4e983e044c1d3a615
parent
d65ed0428395f6ac6a3de7a03dad02a0e568cd75
Author
Tobias Bengfort <tobias.bengfort@gmx.net>
Date
2010-11-18 12:28
check mad

Diffstat

M configure.ac 21 ++++++++++++++++++---
A src/gui/retimer_wx.cpp.in 281 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A src/rbprocess.h 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
M src/sample.cpp 2 +-

4 files changed, 375 insertions, 4 deletions


diff --git a/configure.ac b/configure.ac

@@ -29,6 +29,7 @@ if test "x$icons" = "x" ; then
   29    29   _CFLAGS="$_CFLAGS -DICONS_GNOME"
   30    30   echo "  Compiling with Gnome icons"
   31    31 else
   -1    32   _CFLAGS="$_CFLAGS -UICONS_GNOME"
   32    33   echo "  Compiling without Gnome icons!"
   33    34 fi
   34    35 
@@ -37,10 +38,24 @@ PKG_CHECK_MODULES([SDL],[sdl])
   37    38 PKG_CHECK_MODULES([sndfile],[sndfile])
   38    39 
   39    40 PKG_CHECK_MODULES([RubberBand],[rubberband >= 1.4],
   40    -1 	[_CFLAGS="$_CFLAGS -DMODE_RUBBERBAND"
   41    -1          _PKGC="$_PKGC rubberband"
   -1    41 	[
   -1    42 	_CFLAGS="$_CFLAGS -DMODE_RUBBERBAND"
   -1    43 	_PKGC="$_PKGC rubberband"
   42    44 	 echo "  Compiling with RubberBand support"],
   43    -1 	[ echo "  Compiling without RubberBand support!"])
   -1    45 	[
   -1    46 	_CFLAGS="$_CFLAGS -UMODE_RUBBERBAND"
   -1    47 	echo "  Compiling without RubberBand support!"
   -1    48 	])
   -1    49 
   -1    50 PKG_CHECK_MODULES([mad],[mad],
   -1    51 	[
   -1    52 	_CFLAGS="$_CFLAGS -DENABLE_MP3"
   -1    53 #	_PKGC="$_PKGC rubberband"
   -1    54 	 echo "  Compiling with mp3 support"],
   -1    55 	[
   -1    56 	_CFLAGS="$_CFLAGS -UENABLE_MP3"
   -1    57 	echo "  Compiling without mp3 support!"
   -1    58 	])
   44    59 
   45    60 # Checks for typedefs, structures, and compiler characteristics.
   46    61 AC_HEADER_STDBOOL

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

@@ -0,0 +1,281 @@
   -1     1 ///////////////////////////////////////////////////////////////////////////
   -1     2 // C++ code generated with wxFormBuilder (version Dec 21 2009)
   -1     3 // http://www.wxformbuilder.org/
   -1     4 //
   -1     5 // PLEASE DO "NOT" EDIT THIS FILE!
   -1     6 ///////////////////////////////////////////////////////////////////////////
   -1     7 // sorry guys, I edited it
   -1     8 
   -1     9 #include "retimer_wx.h"
   -1    10 
   -1    11 ///////////////////////////////////////////////////////////////////////////
   -1    12 
   -1    13 MainFrame::MainFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style )
   -1    14 {
   -1    15 wxInitAllImageHandlers();
   -1    16 	this->SetSizeHints( wxDefaultSize, wxDefaultSize );
   -1    17 	
   -1    18 	wxBoxSizer* bSizer3;
   -1    19 	bSizer3 = new wxBoxSizer( wxVERTICAL );
   -1    20 	
   -1    21 	this->SetSizer( bSizer3 );
   -1    22 	this->Layout();
   -1    23 	m_statusBar1 = this->CreateStatusBar( 1, wxST_SIZEGRIP, wxID_ANY );
   -1    24 	m_menubar3 = new wxMenuBar( 0 );
   -1    25 	m_file = new wxMenu();
   -1    26 	wxMenuItem* m_open;
   -1    27 	m_open = new wxMenuItem( m_file, wxID_ANY, wxString( wxT("open") ) + wxT('\t') + wxT("CTRL+f"), wxEmptyString, wxITEM_NORMAL );
   -1    28 	#ifdef ICONS_GNOME
   -1    29 	m_open->SetBitmap( wxBitmap( wxT("/usr/share/icons/gnome/16x16/actions/fileopen.png"), wxBITMAP_TYPE_ANY ) );
   -1    30 	#endif
   -1    31 	m_file->Append( m_open );
   -1    32 	
   -1    33 	wxMenuItem* m_export;
   -1    34 	m_export = new wxMenuItem( m_file, wxID_ANY, wxString( wxT("export") ) + wxT('\t') + wxT("CTRL+s"), wxEmptyString, wxITEM_NORMAL );
   -1    35 	#ifdef ICONS_GNOME
   -1    36 	m_export->SetBitmap( wxBitmap( wxT("/usr/share/icons/gnome/16x16/actions/document-save.png"), wxBITMAP_TYPE_ANY ) );
   -1    37 	#endif
   -1    38 	m_file->Append( m_export );
   -1    39 	
   -1    40 	wxMenuItem* m_separator6;
   -1    41 	m_separator6 = m_file->AppendSeparator();
   -1    42 	
   -1    43 	wxMenuItem* m_prefs;
   -1    44 	m_prefs = new wxMenuItem( m_file, wxID_ANY, wxString( wxT("preferences") ) + wxT('\t') + wxT("F5"), wxEmptyString, wxITEM_NORMAL );
   -1    45 	#ifdef ICONS_GNOME
   -1    46 	m_prefs->SetBitmap( wxBitmap( wxT("/usr/share/icons/gnome/16x16/actions/document-properties.png"), wxBITMAP_TYPE_ANY ) );
   -1    47 	#endif
   -1    48 	m_file->Append( m_prefs );
   -1    49 	
   -1    50 	wxMenuItem* m_separator7;
   -1    51 	m_separator7 = m_file->AppendSeparator();
   -1    52 	
   -1    53 	wxMenuItem* b_exit;
   -1    54 	b_exit = new wxMenuItem( m_file, wxID_ANY, wxString( wxT("Exit") ) , wxEmptyString, wxITEM_NORMAL );
   -1    55 	#ifdef ICONS_GNOME
   -1    56 	b_exit->SetBitmap( wxBitmap( wxT("/usr/share/icons/gnome/16x16/actions/window-close.png"), wxBITMAP_TYPE_ANY ) );
   -1    57 	#endif
   -1    58 	m_file->Append( b_exit );
   -1    59 	
   -1    60 	m_menubar3->Append( m_file, wxT("File") );
   -1    61 	
   -1    62 	m_edit = new wxMenu();
   -1    63 	wxMenuItem* m_play;
   -1    64 	m_play = new wxMenuItem( m_edit, wxID_ANY, wxString( wxT("play/pause") ) + wxT('\t') + wxT("SPACE"), wxEmptyString, wxITEM_NORMAL );
   -1    65 	#ifdef ICONS_GNOME
   -1    66 	m_play->SetBitmap( wxBitmap( wxT("/usr/share/icons/gnome/16x16/actions/media-playback-start.png"), wxBITMAP_TYPE_ANY ) );
   -1    67 	#endif
   -1    68 	m_edit->Append( m_play );
   -1    69 	
   -1    70 	wxMenuItem* m_start;
   -1    71 	m_start = new wxMenuItem( m_edit, wxID_ANY, wxString( wxT("start") ) + wxT('\t') + wxT("CTRL+LEFT"), wxEmptyString, wxITEM_NORMAL );
   -1    72 	#ifdef ICONS_GNOME
   -1    73 	m_start->SetBitmap( wxBitmap( wxT("/usr/share/icons/gnome/16x16/actions/media-skip-backward.png"), wxBITMAP_TYPE_ANY ) );
   -1    74 	#endif
   -1    75 	m_edit->Append( m_start );
   -1    76 	
   -1    77 	wxMenuItem* m_separator8;
   -1    78 	m_separator8 = m_edit->AppendSeparator();
   -1    79 	
   -1    80 	wxMenuItem* m_clear;
   -1    81 	m_clear = new wxMenuItem( m_edit, wxID_ANY, wxString( wxT("clear markers") ) + wxT('\t') + wxT("CTRL+c"), wxEmptyString, wxITEM_NORMAL );
   -1    82 	#ifdef ICONS_GNOME
   -1    83 	m_clear->SetBitmap( wxBitmap( wxT("/usr/share/icons/gnome/16x16/actions/edit-clear.png"), wxBITMAP_TYPE_ANY ) );
   -1    84 	#endif
   -1    85 	m_edit->Append( m_clear );
   -1    86 	
   -1    87 	wxMenuItem* m_process;
   -1    88 	m_process = new wxMenuItem( m_edit, wxID_ANY, wxString( wxT("update audio data") ) + wxT('\t') + wxT("CTRL+u"), wxEmptyString, wxITEM_NORMAL );
   -1    89 	#ifdef ICONS_GNOME
   -1    90 	m_process->SetBitmap( wxBitmap( wxT("/usr/share/icons/gnome/16x16/actions/stock_refresh.png"), wxBITMAP_TYPE_ANY ) );
   -1    91 	#endif
   -1    92 	m_edit->Append( m_process );
   -1    93 	
   -1    94 	m_menubar3->Append( m_edit, wxT("Edit") );
   -1    95 	
   -1    96 	m_help = new wxMenu();
   -1    97 	wxMenuItem* m_about;
   -1    98 	m_about = new wxMenuItem( m_help, wxID_ANY, wxString( wxT("about") ) + wxT('\t') + wxT("F1"), wxEmptyString, wxITEM_NORMAL );
   -1    99 	#ifdef ICONS_GNOME
   -1   100 	m_about->SetBitmap( wxBitmap( wxT("/usr/share/icons/gnome/16x16/actions/help-about.png"), wxBITMAP_TYPE_ANY ) );
   -1   101 	#endif
   -1   102 	m_help->Append( m_about );
   -1   103 	
   -1   104 	m_menubar3->Append( m_help, wxT("Help") );
   -1   105 	
   -1   106 	this->SetMenuBar( m_menubar3 );
   -1   107 	
   -1   108 	
   -1   109 	// Connect Events
   -1   110 	this->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( MainFrame::OnLeftDClick ) );
   -1   111 	this->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( MainFrame::OnLeftDown ) );
   -1   112 	this->Connect( wxEVT_LEFT_UP, wxMouseEventHandler( MainFrame::OnLeftUp ) );
   -1   113 	this->Connect( wxEVT_MOTION, wxMouseEventHandler( MainFrame::OnMotion ) );
   -1   114 	this->Connect( wxEVT_PAINT, wxPaintEventHandler( MainFrame::OnPaint ) );
   -1   115 	this->Connect( wxEVT_SIZE, wxSizeEventHandler( MainFrame::OnSize ) );
   -1   116 	this->Connect( m_open->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnOpenClick ) );
   -1   117 	this->Connect( m_export->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnExportClick ) );
   -1   118 	this->Connect( m_prefs->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnPrefsClick ) );
   -1   119 	this->Connect( b_exit->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnExitClick ) );
   -1   120 	this->Connect( m_play->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnPlayClick ) );
   -1   121 	this->Connect( m_start->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnStartClick ) );
   -1   122 	this->Connect( m_clear->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnClearClick ) );
   -1   123 	this->Connect( m_process->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnProcessClick ) );
   -1   124 	this->Connect( m_about->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnHelpClick ) );
   -1   125 }
   -1   126 
   -1   127 MainFrame::~MainFrame()
   -1   128 {
   -1   129 	// Disconnect Events
   -1   130 	this->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( MainFrame::OnLeftDClick ) );
   -1   131 	this->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( MainFrame::OnLeftDown ) );
   -1   132 	this->Disconnect( wxEVT_LEFT_UP, wxMouseEventHandler( MainFrame::OnLeftUp ) );
   -1   133 	this->Disconnect( wxEVT_MOTION, wxMouseEventHandler( MainFrame::OnMotion ) );
   -1   134 	this->Disconnect( wxEVT_PAINT, wxPaintEventHandler( MainFrame::OnPaint ) );
   -1   135 	this->Disconnect( wxEVT_SIZE, wxSizeEventHandler( MainFrame::OnSize ) );
   -1   136 	this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnOpenClick ) );
   -1   137 	this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnExportClick ) );
   -1   138 	this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnPrefsClick ) );
   -1   139 	this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnExitClick ) );
   -1   140 	this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnPlayClick ) );
   -1   141 	this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnStartClick ) );
   -1   142 	this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnClearClick ) );
   -1   143 	this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnProcessClick ) );
   -1   144 	this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnHelpClick ) );
   -1   145 }
   -1   146 
   -1   147 AboutDialog::AboutDialog( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
   -1   148 {
   -1   149 	this->SetSizeHints( wxDefaultSize, wxDefaultSize );
   -1   150 	
   -1   151 	wxBoxSizer* bSizer4;
   -1   152 	bSizer4 = new wxBoxSizer( wxVERTICAL );
   -1   153 	
   -1   154 	wxBoxSizer* bSizer14;
   -1   155 	bSizer14 = new wxBoxSizer( wxVERTICAL );
   -1   156 	
   -1   157 	m_staticText7 = new wxStaticText( this, wxID_ANY, wxT("xiRetimer v@VERSION@"), wxDefaultPosition, wxDefaultSize, 0 );
   -1   158 	m_staticText7->Wrap( -1 );
   -1   159 	bSizer14->Add( m_staticText7, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
   -1   160 	
   -1   161 	m_staticText1 = new wxStaticText( this, wxID_ANY, wxT("Created by xi."), wxDefaultPosition, wxDefaultSize, 0 );
   -1   162 	m_staticText1->Wrap( -1 );
   -1   163 	bSizer14->Add( m_staticText1, 0, wxALIGN_CENTER|wxALL, 5 );
   -1   164 	
   -1   165 	m_staticText2 = new wxStaticText( this, wxID_ANY, wxT("www.github.com/xi"), wxDefaultPosition, wxDefaultSize, 0 );
   -1   166 	m_staticText2->Wrap( -1 );
   -1   167 	bSizer14->Add( m_staticText2, 0, wxALIGN_CENTER|wxALL, 5 );
   -1   168 	
   -1   169 	bSizer4->Add( bSizer14, 1, wxEXPAND, 5 );
   -1   170 	
   -1   171 	wxBoxSizer* bSizer7;
   -1   172 	bSizer7 = new wxBoxSizer( wxVERTICAL );
   -1   173 	
   -1   174 	m_button1 = new wxButton( this, wxID_ANY, wxT("OK"), wxDefaultPosition, wxDefaultSize, 0 );
   -1   175 	bSizer7->Add( m_button1, 0, wxALIGN_CENTER|wxALL, 5 );
   -1   176 	
   -1   177 	bSizer4->Add( bSizer7, 0, wxEXPAND, 5 );
   -1   178 	
   -1   179 	this->SetSizer( bSizer4 );
   -1   180 	this->Layout();
   -1   181 	
   -1   182 	// Connect Events
   -1   183 	m_button1->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( AboutDialog::OnOKClick ), NULL, this );
   -1   184 }
   -1   185 
   -1   186 AboutDialog::~AboutDialog()
   -1   187 {
   -1   188 	// Disconnect Events
   -1   189 	m_button1->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( AboutDialog::OnOKClick ), NULL, this );
   -1   190 }
   -1   191 
   -1   192 PrefsDialog::PrefsDialog( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
   -1   193 {
   -1   194 	this->SetSizeHints( wxDefaultSize, wxDefaultSize );
   -1   195 	
   -1   196 	wxBoxSizer* bSizer5;
   -1   197 	bSizer5 = new wxBoxSizer( wxVERTICAL );
   -1   198 	
   -1   199 	wxFlexGridSizer* fgSizer4;
   -1   200 	fgSizer4 = new wxFlexGridSizer( 2, 2, 0, 0 );
   -1   201 	fgSizer4->AddGrowableCol( 1 );
   -1   202 	fgSizer4->SetFlexibleDirection( wxBOTH );
   -1   203 	fgSizer4->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
   -1   204 	
   -1   205 	l_intmode = new wxStaticText( this, wxID_ANY, wxT("Interpolation Mode"), wxDefaultPosition, wxDefaultSize, 0 );
   -1   206 	l_intmode->Wrap( -1 );
   -1   207 	fgSizer4->Add( l_intmode, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
   -1   208 	
   -1   209 	wxString c_intmodeChoices[] = { wxT("Linear") };
   -1   210 	int c_intmodeNChoices = sizeof( c_intmodeChoices ) / sizeof( wxString );
   -1   211 	c_intmode = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, c_intmodeNChoices, c_intmodeChoices, 0 );
   -1   212 	c_intmode->SetSelection( 0 );
   -1   213 	fgSizer4->Add( c_intmode, 1, wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
   -1   214 	
   -1   215 	l_stretchmode = new wxStaticText( this, wxID_ANY, wxT("Stretch Mode"), wxDefaultPosition, wxDefaultSize, 0 );
   -1   216 	l_stretchmode->Wrap( -1 );
   -1   217 	fgSizer4->Add( l_stretchmode, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
   -1   218 	
   -1   219 	// TODO
   -1   220 #ifdef MODE_RUBBERBAND
   -1   221 	wxString c_stretchmodeChoices[] = { wxT("none"), wxT("RubberBand")};
   -1   222 #else
   -1   223 	wxString c_stretchmodeChoices[] = { wxT("none"), wxT("RubberBand (diabled)")};
   -1   224 #endif
   -1   225 	
   -1   226 	int c_stretchmodeNChoices = sizeof( c_stretchmodeChoices ) / sizeof( wxString );
   -1   227 	c_stretchmode = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, c_stretchmodeNChoices, c_stretchmodeChoices, 0 );
   -1   228 	c_stretchmode->SetSelection( 0 );
   -1   229 	fgSizer4->Add( c_stretchmode, 1, wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
   -1   230 	
   -1   231 	l_tempo = new wxStaticText( this, wxID_ANY, wxT("Tempo"), wxDefaultPosition, wxDefaultSize, 0 );
   -1   232 	l_tempo->Wrap( -1 );
   -1   233 	fgSizer4->Add( l_tempo, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
   -1   234 	
   -1   235 	t_tempo = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER|wxTE_RIGHT );
   -1   236 	fgSizer4->Add( t_tempo, 1, wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
   -1   237 	
   -1   238 	l_beatres = new wxStaticText( this, wxID_ANY, wxT("Beat Resolution"), wxDefaultPosition, wxDefaultSize, 0 );
   -1   239 	l_beatres->Wrap( -1 );
   -1   240 	fgSizer4->Add( l_beatres, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
   -1   241 	
   -1   242 	t_beatres = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER|wxTE_RIGHT );
   -1   243 	fgSizer4->Add( t_beatres, 1, wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
   -1   244 	
   -1   245 	bSizer5->Add( fgSizer4, 1, wxEXPAND, 5 );
   -1   246 	
   -1   247 	wxBoxSizer* bSizer15;
   -1   248 	bSizer15 = new wxBoxSizer( wxHORIZONTAL );
   -1   249 	
   -1   250 	b_OK = new wxButton( this, wxID_ANY, wxT("OK"), wxDefaultPosition, wxDefaultSize, 0 );
   -1   251 	bSizer15->Add( b_OK, 0, wxALL|wxALIGN_BOTTOM|wxALIGN_RIGHT, 5 );
   -1   252 	
   -1   253 	b_Cancel = new wxButton( this, wxID_ANY, wxT("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
   -1   254 	b_Cancel->SetToolTip( wxT("Escape") );
   -1   255 	
   -1   256 	bSizer15->Add( b_Cancel, 0, wxALIGN_BOTTOM|wxALIGN_RIGHT|wxALL, 5 );
   -1   257 	
   -1   258 	bSizer5->Add( bSizer15, 0, wxALIGN_RIGHT, 5 );
   -1   259 	
   -1   260 	this->SetSizer( bSizer5 );
   -1   261 	this->Layout();
   -1   262 	
   -1   263 	// Connect Events
   -1   264 	c_intmode->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PrefsDialog::OnIntModeChange ), NULL, this );
   -1   265 	c_stretchmode->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PrefsDialog::OnStretchModeChange ), NULL, this );
   -1   266 	t_tempo->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( PrefsDialog::OnTempoEnter ), NULL, this );
   -1   267 	t_beatres->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( PrefsDialog::OnBeatResEnter ), NULL, this );
   -1   268 	b_OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PrefsDialog::OnOKClick ), NULL, this );
   -1   269 	b_Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PrefsDialog::OnCancelClick ), NULL, this );
   -1   270 }
   -1   271 
   -1   272 PrefsDialog::~PrefsDialog()
   -1   273 {
   -1   274 	// Disconnect Events
   -1   275 	c_intmode->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PrefsDialog::OnIntModeChange ), NULL, this );
   -1   276 	c_stretchmode->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PrefsDialog::OnStretchModeChange ), NULL, this );
   -1   277 	t_tempo->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( PrefsDialog::OnTempoEnter ), NULL, this );
   -1   278 	t_beatres->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( PrefsDialog::OnBeatResEnter ), NULL, this );
   -1   279 	b_OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PrefsDialog::OnOKClick ), NULL, this );
   -1   280 	b_Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PrefsDialog::OnCancelClick ), NULL, this );
   -1   281 }

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

@@ -0,0 +1,75 @@
   -1     1 #ifndef __RBPROCESS_H
   -1     2 #define __RBPROCESS_H
   -1     3 #ifdef MODE_RUBBERBAND
   -1     4 
   -1     5 #include "marker.h"
   -1     6 #include "sample.h"
   -1     7 
   -1     8 #include <rubberband/RubberBandStretcher.h>
   -1     9 #include <map>
   -1    10 
   -1    11 /*
   -1    12 this is called by sample.process()
   -1    13 this uses the rubberband library
   -1    14 */
   -1    15 
   -1    16 int RBprocess(int olength, float* data, Marker* marker, Sample* sample, int n=1) {
   -1    17 
   -1    18   int length=sample->getLength();
   -1    19   int ostart=int(marker->getOld(0)*olength);
   -1    20   if (ostart<0) ostart=0;
   -1    21   int olength2=int(marker->getOld(marker->getLength()-1)*olength)-ostart;
   -1    22   if (olength2>olength-ostart) olength2=olength-ostart;
   -1    23 
   -1    24   float **ibuf = new float *[1];
   -1    25   ibuf[0]=new float[olength2];
   -1    26   for (int i=0; i<olength2; ++i) {
   -1    27     ibuf[0][i]=sample->getOld((ostart+i)/(float)olength);
   -1    28   }
   -1    29 
   -1    30   float **obuf = new float *[1];
   -1    31   obuf[0]=data;
   -1    32 
   -1    33   RubberBand::RubberBandStretcher ts(44100, 1, 0, 1);
   -1    34   // map
   -1    35   std::map<unsigned int, unsigned int> fmap;
   -1    36   for (int i=0; i<length; i+=1024) {
   -1    37     float old= marker->nnew2new(marker->new2old(i/(float)length));
   -1    38     fmap[int(old*olength)-ostart]=int(i);
   -1    39   }
   -1    40   ts.setKeyFrameMap(fmap);
   -1    41 
   -1    42   sample->setFinished(0.03);
   -1    43   ts.study(ibuf, olength2, true);
   -1    44   ts.setMaxProcessSize(olength2);
   -1    45   int a1=-1;
   -1    46   int a2=0;
   -1    47   sample->setFinished(0.06);
   -1    48   ts.process(ibuf, olength2, true);
   -1    49   sample->setFinished(0.9);
   -1    50 
   -1    51   int avail=ts.available();
   -1    52   if (avail>length) avail=length;
   -1    53   ts.retrieve(obuf, avail);
   -1    54 
   -1    55   for (int j=0; j<avail; ++j) {
   -1    56     float value = obuf[0][j];
   -1    57     if (value > 1.f) value = 1.f;
   -1    58     if (value < -1.f) value = -1.f;
   -1    59     data[j] = value;
   -1    60   }
   -1    61 
   -1    62   for (int i=avail; i<length; ++i) {
   -1    63     data[i]=0;
   -1    64   }
   -1    65 
   -1    66   delete[] ibuf[0];
   -1    67   delete[] ibuf;
   -1    68   delete[] obuf;
   -1    69 
   -1    70   return 0;
   -1    71 }
   -1    72 
   -1    73 #endif
   -1    74 
   -1    75 #endif

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

@@ -1,7 +1,7 @@
    1     1 #include "sample.h"
    2     2 #include <pthread.h>
    3     3 
    4    -1 #include "rbprocess.cpp"
   -1     4 #include "rbprocess.h"
    5     5 
    6     6 Sample::Sample(Marker* m) {
    7     7   marker=m;