Can loop a region now.
This commit is contained in:
parent
f061fe8a8c
commit
0eaf78923c
|
|
@ -557,7 +557,7 @@ void MainFrame::OnClickSettings(wxCommandEvent& event)
|
||||||
}
|
}
|
||||||
if (settings->IsWaveformColourChanged())
|
if (settings->IsWaveformColourChanged())
|
||||||
{
|
{
|
||||||
m_TopWaveformPanel->ResetDC();
|
m_TopWaveformPanel->ResetDC(m_MediaCtrl->GetState() == wxMEDIASTATE_PLAYING);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case wxID_CANCEL:
|
case wxID_CANCEL:
|
||||||
|
|
@ -948,9 +948,15 @@ void MainFrame::OnClickPlay(wxCommandEvent& event)
|
||||||
PushStatusText(wxString::Format(_("Now playing: %s"), selection), 1);
|
PushStatusText(wxString::Format(_("Now playing: %s"), selection), 1);
|
||||||
|
|
||||||
// Update waveform bitmap
|
// Update waveform bitmap
|
||||||
m_TopWaveformPanel->ResetDC();
|
// m_TopWaveformPanel->ResetDC();
|
||||||
|
|
||||||
m_MediaCtrl->Play();
|
if (bLoop && m_LoopPointAButton->GetValue() && m_LoopPointAButton->GetValue())
|
||||||
|
{
|
||||||
|
m_MediaCtrl->Seek(m_LoopA.GetValue(), wxFromStart);
|
||||||
|
m_MediaCtrl->Play();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
m_MediaCtrl->Play();
|
||||||
|
|
||||||
m_Timer->Start(100, wxTIMER_CONTINUOUS);
|
m_Timer->Start(100, wxTIMER_CONTINUOUS);
|
||||||
}
|
}
|
||||||
|
|
@ -1099,7 +1105,7 @@ void MainFrame::OnClickLibrary(wxDataViewEvent& event)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the waveform bitmap
|
// Update the waveform bitmap
|
||||||
m_TopWaveformPanel->ResetDC();
|
m_TopWaveformPanel->ResetDC(m_MediaCtrl->GetState() == wxMEDIASTATE_PLAYING);
|
||||||
|
|
||||||
wxString selection = m_Library->GetTextValue(selected_row, 1);
|
wxString selection = m_Library->GetTextValue(selected_row, 1);
|
||||||
|
|
||||||
|
|
@ -1138,13 +1144,22 @@ void MainFrame::OnClickLibrary(wxDataViewEvent& event)
|
||||||
|
|
||||||
if (CurrentColumn != FavoriteColumn)
|
if (CurrentColumn != FavoriteColumn)
|
||||||
{
|
{
|
||||||
|
ClearLoopPoints();
|
||||||
|
|
||||||
m_MediaCtrl->Load(sample_path);
|
m_MediaCtrl->Load(sample_path);
|
||||||
|
|
||||||
if (bAutoplay)
|
if (bAutoplay)
|
||||||
{
|
{
|
||||||
PushStatusText(wxString::Format(_("Now playing: %s"), selection), 1);
|
PushStatusText(wxString::Format(_("Now playing: %s"), selection), 1);
|
||||||
|
|
||||||
m_MediaCtrl->Play();
|
if (bLoop && m_LoopPointAButton->GetValue() && m_LoopPointAButton->GetValue())
|
||||||
|
{
|
||||||
|
m_MediaCtrl->Seek(m_LoopA.GetValue(), wxFromStart);
|
||||||
|
m_MediaCtrl->Play();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
m_MediaCtrl->Play();
|
||||||
|
|
||||||
m_Timer->Start(100, wxTIMER_CONTINUOUS);
|
m_Timer->Start(100, wxTIMER_CONTINUOUS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2949,13 +2964,13 @@ void MainFrame::OnRecieveLoopPoints(SampleHive::SH_LoopPointsEvent& event)
|
||||||
|
|
||||||
std::pair<double, double> loop_points = event.GetLoopPoints();
|
std::pair<double, double> loop_points = event.GetLoopPoints();
|
||||||
|
|
||||||
wxLongLong loopA = loop_points.first;
|
m_LoopA = wxLongLong(loop_points.first);
|
||||||
wxLongLong loopB = loop_points.second;
|
m_LoopB = wxLongLong(loop_points.second);
|
||||||
|
|
||||||
int loopA_min = static_cast<int>((loopA / 60000).GetValue());
|
int loopA_min = static_cast<int>((m_LoopA / 60000).GetValue());
|
||||||
int loopA_sec = static_cast<int>(((loopA % 60000) / 1000).GetValue());
|
int loopA_sec = static_cast<int>(((m_LoopA % 60000) / 1000).GetValue());
|
||||||
int loopB_min = static_cast<int>((loopB / 60000).GetValue());
|
int loopB_min = static_cast<int>((m_LoopB / 60000).GetValue());
|
||||||
int loopB_sec = static_cast<int>(((loopB % 60000) / 1000).GetValue());
|
int loopB_sec = static_cast<int>(((m_LoopB % 60000) / 1000).GetValue());
|
||||||
|
|
||||||
wxLogDebug(wxString::Format("LoopA: %2i:%02i, LoopB: %2i:%02i",
|
wxLogDebug(wxString::Format("LoopA: %2i:%02i, LoopB: %2i:%02i",
|
||||||
loopA_min, loopA_sec, loopB_min, loopB_sec));
|
loopA_min, loopA_sec, loopB_min, loopB_sec));
|
||||||
|
|
@ -2963,7 +2978,9 @@ void MainFrame::OnRecieveLoopPoints(SampleHive::SH_LoopPointsEvent& event)
|
||||||
m_LoopPointAText->SetValue(wxString::Format("%2i:%02i", loopA_min, loopA_sec));
|
m_LoopPointAText->SetValue(wxString::Format("%2i:%02i", loopA_min, loopA_sec));
|
||||||
m_LoopPointBText->SetValue(wxString::Format("%2i:%02i", loopB_min, loopB_sec));
|
m_LoopPointBText->SetValue(wxString::Format("%2i:%02i", loopB_min, loopB_sec));
|
||||||
|
|
||||||
// TODO Looping the selected section
|
if (bLoop && m_LoopPointAButton->GetValue() && m_LoopPointAButton->GetValue())
|
||||||
|
if (static_cast<double>(m_MediaCtrl->Tell()) >= static_cast<double>(m_LoopB.GetValue()))
|
||||||
|
m_MediaCtrl->Seek(m_LoopA.GetValue(), wxFromStart);
|
||||||
|
|
||||||
wxLogDebug("%s Event processed successfully..", __FUNCTION__);
|
wxLogDebug("%s Event processed successfully..", __FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
@ -2975,4 +2992,16 @@ void MainFrame::OnRecieveStatusBarStatus(SampleHive::SH_SetStatusBarMessageEvent
|
||||||
m_StatusBar->PushStatusText(status.first, status.second);
|
m_StatusBar->PushStatusText(status.first, status.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainFrame::ClearLoopPoints()
|
||||||
|
{
|
||||||
|
m_LoopPointAText->SetValue("00:00");
|
||||||
|
m_LoopPointBText->SetValue("00:00");
|
||||||
|
|
||||||
|
m_LoopPointAButton->Disable();
|
||||||
|
m_LoopPointBButton->Disable();
|
||||||
|
|
||||||
|
m_LoopA = 0;
|
||||||
|
m_LoopB = 0;
|
||||||
|
}
|
||||||
|
|
||||||
MainFrame::~MainFrame(){}
|
MainFrame::~MainFrame(){}
|
||||||
|
|
|
||||||
|
|
@ -170,6 +170,8 @@ class MainFrame : public wxFrame
|
||||||
// FileSystemWatcher
|
// FileSystemWatcher
|
||||||
wxFileSystemWatcher* m_FsWatcher;
|
wxFileSystemWatcher* m_FsWatcher;
|
||||||
|
|
||||||
|
wxLongLong m_LoopA, m_LoopB;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
bool bAutoplay = false;
|
bool bAutoplay = false;
|
||||||
|
|
@ -277,6 +279,9 @@ class MainFrame : public wxFrame
|
||||||
// Call after frame creation
|
// Call after frame creation
|
||||||
void SetAfterFrameCreate();
|
void SetAfterFrameCreate();
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------
|
||||||
|
void ClearLoopPoints();
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
friend class App;
|
friend class App;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -420,13 +420,16 @@ void WaveformViewer::OnMouseLeftButtonUp(wxMouseEvent& event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaveformViewer::ResetDC()
|
void WaveformViewer::ResetDC(bool playing)
|
||||||
{
|
{
|
||||||
bBitmapDirty = true;
|
if (!playing)
|
||||||
bSelectRange = false;
|
{
|
||||||
bDrawSelectedArea = false;
|
bBitmapDirty = true;
|
||||||
|
bSelectRange = false;
|
||||||
|
bDrawSelectedArea = false;
|
||||||
|
|
||||||
Refresh();
|
Refresh();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaveformViewer::SendLoopPoints()
|
void WaveformViewer::SendLoopPoints()
|
||||||
|
|
|
||||||
|
|
@ -94,5 +94,5 @@ class WaveformViewer : public wxPanel
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
void ResetDC();
|
void ResetDC(bool playing);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue