- commit
- 2e74f7ec573b1a089b85d28e9301967557feb8d9
- parent
- ed04cf48f2f3034c5129fb1906578fde222bcb90
- Author
- Tobias Bengfort <tobias.bengfort@gmx.net>
- Date
- 2010-11-07 14:13
seeker update
Diffstat
| M | README | 2 | -- |
| M | src/curve.cpp | 10 | ---------- |
| M | src/gui/RetimerMainFrame.cpp | 5 | ----- |
| M | src/gui/RetimerMainFrame.h | 1 | - |
| M | src/gui/retimer_wx.cpp | 11 | ----------- |
| M | src/gui/retimer_wx.fbp | 15 | --------------- |
| M | src/gui/retimer_wx.h | 1 | - |
| M | src/playback.cpp | 37 | +++++++++++++++++++++++-------------- |
| M | xiRetimer | 0 |
9 files changed, 23 insertions, 59 deletions
diff --git a/README b/README
@@ -10,9 +10,7 @@ timestretch - rubberband (v>=1.5) 10 10 11 11 12 12 TODO13 -1 renaming (remove xi)14 13 rubberband crashes15 -1 remove deprecated buttons16 14 smooth interpolation 17 15 always update gui 18 16 libmad
diff --git a/src/curve.cpp b/src/curve.cpp
@@ -2,8 +2,6 @@ 2 2 3 3 #include <cmath> 4 45 -1 // TODO change first and last marker6 -17 5 Curve::Curve(Marker* m, Sample* s, Playback* p) { 8 6 marker=m; 9 7 sample=s; @@ -19,7 +17,6 @@ Curve::~Curve() { 19 17 } 20 18 21 19 float Curve::get(float nn) {22 -1 // TODO interpolation?23 20 return sample->getOld(marker->new2old(marker->nnew2new(nn))); 24 21 } 25 22 @@ -62,19 +59,12 @@ float Curve::getBeatResolution() {return beatResolution;} 62 59 void Curve::addMarker() { 63 60 float n=marker->nnew2new(getSeeker()); 64 61 marker->add(marker->new2old(n),n);65 -1 // update selMarker66 -1 /*67 -1 if (n<selMarker) --selMarker;68 -1 if (selMarker>=getMarkerLength()) --selMarker;69 -1 */70 62 selMarker=marker->getAreaNew(n); 71 63 } 72 64 73 65 void Curve::removeMarker() { 74 66 if (selMarker<0) return; 75 67 marker->remove(selMarker);76 -1 // update selMarker77 -1 // if (selMarker>=getMarkerLength()) --selMarker;78 68 selMarker=-1; 79 69 } 80 70
diff --git a/src/gui/RetimerMainFrame.cpp b/src/gui/RetimerMainFrame.cpp
@@ -125,10 +125,6 @@ void RetimerMainFrame::OnPlayClick( wxCommandEvent& event ) {
125 125 playback->play();
126 126 }
127 127
128 -1 void RetimerMainFrame::OnEndClick( wxCommandEvent& event ) {
129 -1 playback->setSeeker(1);
130 -1 }
131 -1
132 128 // ************ general **************
133 129 void RetimerMainFrame::OnPrefsClick( wxCommandEvent& event )
134 130 {
@@ -221,7 +217,6 @@ void RetimerMainFrame::paint() {
221 217 }
222 218 // seeker
223 219 bdc.SetPen(*penSeeker);
224 -1 playback->setSeeker(curve->getSeeker());
225 220 int seek=int(curve->getSeeker()*(width-1));
226 221 bdc.DrawLine(seek,0,seek,height);
227 222 //beats
diff --git a/src/gui/RetimerMainFrame.h b/src/gui/RetimerMainFrame.h
@@ -36,7 +36,6 @@ protected: 36 36 // playback 37 37 void OnStartClick( wxCommandEvent& event ); 38 38 void OnPlayClick( wxCommandEvent& event );39 -1 void OnEndClick( wxCommandEvent& event );40 39 // general 41 40 void OnExitClick( wxCommandEvent& event ); 42 41 void OnHelpClick( wxCommandEvent& event );
diff --git a/src/gui/retimer_wx.cpp b/src/gui/retimer_wx.cpp
@@ -85,15 +85,6 @@ wxInitAllImageHandlers(); 85 85 #endif 86 86 m_edit->Append( m_start ); 87 8788 -1 wxMenuItem* m_end;89 -1 m_end = new wxMenuItem( m_edit, wxID_ANY, wxString( wxT("end") ) + wxT('\t') + wxT("CTRL+RIGHT"), wxEmptyString, wxITEM_NORMAL );90 -1 #ifdef __WXMSW__91 -1 m_end->SetBitmaps( wxBitmap( wxT("/usr/share/icons/gnome/16x16/actions/media-skip-forward.png"), wxBITMAP_TYPE_ANY ) );92 -1 #elif defined( __WXGTK__ )93 -1 m_end->SetBitmap( wxBitmap( wxT("/usr/share/icons/gnome/16x16/actions/media-skip-forward.png"), wxBITMAP_TYPE_ANY ) );94 -1 #endif95 -1 m_edit->Append( m_end );96 -197 88 wxMenuItem* m_separator8; 98 89 m_separator8 = m_edit->AppendSeparator(); 99 90 @@ -145,7 +136,6 @@ wxInitAllImageHandlers(); 145 136 this->Connect( b_exit->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnExitClick ) ); 146 137 this->Connect( m_play->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnPlayClick ) ); 147 138 this->Connect( m_start->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnStartClick ) );148 -1 this->Connect( m_end->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnEndClick ) );149 139 this->Connect( m_clear->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnClearClick ) ); 150 140 this->Connect( m_process->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnProcessClick ) ); 151 141 this->Connect( m_about->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnHelpClick ) ); @@ -166,7 +156,6 @@ MainFrame::~MainFrame() 166 156 this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnExitClick ) ); 167 157 this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnPlayClick ) ); 168 158 this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnStartClick ) );169 -1 this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnEndClick ) );170 159 this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnClearClick ) ); 171 160 this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnProcessClick ) ); 172 161 this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnHelpClick ) );
diff --git a/src/gui/retimer_wx.fbp b/src/gui/retimer_wx.fbp
@@ -285,21 +285,6 @@ 285 285 <event name="OnMenuSelection">OnStartClick</event> 286 286 <event name="OnUpdateUI"></event> 287 287 </object>288 -1 <object class="wxMenuItem" expanded="1">289 -1 <property name="bitmap">/usr/share/icons/gnome/16x16/actions/media-skip-forward.png; Load From File</property>290 -1 <property name="checked">0</property>291 -1 <property name="enabled">1</property>292 -1 <property name="help"></property>293 -1 <property name="id">wxID_ANY</property>294 -1 <property name="kind">wxITEM_NORMAL</property>295 -1 <property name="label">end</property>296 -1 <property name="name">m_end</property>297 -1 <property name="permission">none</property>298 -1 <property name="shortcut">CTRL+RIGHT</property>299 -1 <property name="unchecked_bitmap"></property>300 -1 <event name="OnMenuSelection">OnEndClick</event>301 -1 <event name="OnUpdateUI"></event>302 -1 </object>303 288 <object class="separator" expanded="1"> 304 289 <property name="name">m_separator8</property> 305 290 <property name="permission">none</property>
diff --git a/src/gui/retimer_wx.h b/src/gui/retimer_wx.h
@@ -56,7 +56,6 @@ class MainFrame : public wxFrame 56 56 virtual void OnExitClick( wxCommandEvent& event ) { event.Skip(); } 57 57 virtual void OnPlayClick( wxCommandEvent& event ) { event.Skip(); } 58 58 virtual void OnStartClick( wxCommandEvent& event ) { event.Skip(); }59 -1 virtual void OnEndClick( wxCommandEvent& event ) { event.Skip(); }60 59 virtual void OnClearClick( wxCommandEvent& event ) { event.Skip(); } 61 60 virtual void OnProcessClick( wxCommandEvent& event ) { event.Skip(); } 62 61 virtual void OnHelpClick( wxCommandEvent& event ) { event.Skip(); }
diff --git a/src/playback.cpp b/src/playback.cpp
@@ -8,12 +8,14 @@ struct sample {
8 8
9 9 Sample* sample;
10 10 float seeker;
-1 11 float oseeker;
11 12 bool _play;
12 13
13 14 Playback::Playback(Sample* s) {
14 15 sample=s;
15 16 _play=false;
16 17 seeker=0;
-1 18 oseeker=0;
17 19
18 20 extern void callback(void *unused, Uint8 *stream, int len);
19 21 SDL_AudioSpec fmt;
@@ -53,9 +55,7 @@ int Playback::play() {
53 55
54 56 int Playback::start() {
55 57 SDL_LockAudio();
56 -1 // if ( sounds.data ) {
57 -1 // free(sounds.data);
58 -1 // }
-1 58
59 59 int length=sample->getLength();
60 60 Uint8 idata[length];
61 61 for (int i=0; i<length; ++i) {
@@ -70,24 +70,32 @@ int Playback::start() {
70 70 }
71 71
72 72 void callback(void *udata, Uint8 *stream, int len) {
73 -1 Uint32 amount;
-1 73 if (_play) {
-1 74 std::cout << seeker;
-1 75 std::cout << oseeker;
-1 76 std::cout << std::endl;
-1 77
-1 78 if (sounds.dpos==sounds.dlen) {
-1 79 _play=false;
-1 80 seeker=float(oseeker);
-1 81 return;
-1 82 }
-1 83 Uint32 amount;
74 84
75 -1 amount = (sounds.dlen-sounds.dpos);
76 -1 if ( amount > len ) {
77 -1 amount = len;
78 -1 }
79 -1 SDL_MixAudio(stream, &sounds.data[sounds.dpos], amount, SDL_MIX_MAXVOLUME);
80 -1 sounds.dpos += amount;
-1 85 amount = (sounds.dlen-sounds.dpos);
-1 86 if ( amount > len ) {
-1 87 amount = len;
-1 88 }
-1 89 SDL_MixAudio(stream, &sounds.data[sounds.dpos], amount, SDL_MIX_MAXVOLUME);
-1 90 sounds.dpos += amount;
81 91
82 -1 // update
83 -1 if (sounds.dpos==sounds.dlen)
84 -1 _play=false;
85 -1 if (_play)
86 92 seeker=sounds.dpos/(float)sounds.dlen;
-1 93 }
87 94 }
88 95
89 96 void Playback::stop() {
90 97 seeker=sounds.dpos/(float)sounds.dlen;
-1 98 oseeker=float(seeker);
91 99 SDL_LockAudio();
92 100 sounds.dpos=sounds.dlen;
93 101 SDL_UnlockAudio();
@@ -95,6 +103,7 @@ void Playback::stop() {
95 103
96 104 void Playback::setSeeker(float nn) {
97 105 seeker=nn;
-1 106 oseeker=float(seeker);
98 107 if (_play) {
99 108 SDL_LockAudio();
100 109 sounds.dpos = int(seeker*sounds.dlen);