mirror of https://github.com/odrling/Aegisub
parent
b3b9d5e033
commit
ae6fcba54e
|
@ -202,7 +202,7 @@ void AudioDisplay::UpdateImage(bool weak) {
|
||||||
// Draw seconds boundaries
|
// Draw seconds boundaries
|
||||||
if (draw_boundary_lines) {
|
if (draw_boundary_lines) {
|
||||||
__int64 start = Position*samples;
|
__int64 start = Position*samples;
|
||||||
int rate = provider ? provider->GetSampleRate() : 0; //fix me?
|
int rate = provider->GetSampleRate();
|
||||||
int pixBounds = rate / samples;
|
int pixBounds = rate / samples;
|
||||||
dc.SetPen(wxPen(Options.AsColour(_T("Audio Seconds Boundaries")),1,wxDOT));
|
dc.SetPen(wxPen(Options.AsColour(_T("Audio Seconds Boundaries")),1,wxDOT));
|
||||||
if (pixBounds >= 8) {
|
if (pixBounds >= 8) {
|
||||||
|
@ -688,12 +688,10 @@ void AudioDisplay::SetSamplesPercent(int percent,bool update,float pivot) {
|
||||||
if (update) {
|
if (update) {
|
||||||
// Center scroll
|
// Center scroll
|
||||||
int oldSamples = samples;
|
int oldSamples = samples;
|
||||||
UpdateSamples();
|
|
||||||
PositionSample += (oldSamples-samples)*w*pivot;
|
PositionSample += (oldSamples-samples)*w*pivot;
|
||||||
if (PositionSample < 0) PositionSample = 0;
|
if (PositionSample < 0) PositionSample = 0;
|
||||||
|
|
||||||
// Update
|
// Update
|
||||||
UpdateSamples();
|
|
||||||
UpdateScrollbar();
|
UpdateScrollbar();
|
||||||
UpdateImage();
|
UpdateImage();
|
||||||
Refresh(false);
|
Refresh(false);
|
||||||
|
@ -705,7 +703,7 @@ void AudioDisplay::SetSamplesPercent(int percent,bool update,float pivot) {
|
||||||
// Update samples
|
// Update samples
|
||||||
void AudioDisplay::UpdateSamples() {
|
void AudioDisplay::UpdateSamples() {
|
||||||
// Set samples
|
// Set samples
|
||||||
__int64 totalSamples = provider ? provider->GetNumSamples() : 0; //fix me?
|
__int64 totalSamples = provider->GetNumSamples();
|
||||||
int total = totalSamples / w;
|
int total = totalSamples / w;
|
||||||
int max = 5760000 / w; // 2 minutes at 48 kHz maximum
|
int max = 5760000 / w; // 2 minutes at 48 kHz maximum
|
||||||
if (total > max) total = max;
|
if (total > max) total = max;
|
||||||
|
@ -742,30 +740,33 @@ void AudioDisplay::SetFile(wxString file) {
|
||||||
delete provider;
|
delete provider;
|
||||||
provider = NULL;
|
provider = NULL;
|
||||||
Reset();
|
Reset();
|
||||||
|
|
||||||
|
loaded = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
SetFile(_T(""));
|
SetFile(_T(""));
|
||||||
try {
|
try {
|
||||||
provider = new AudioProvider(file, this);
|
provider = new AudioProvider(file, this);
|
||||||
|
|
||||||
|
loaded = true;
|
||||||
|
|
||||||
// Add to recent
|
// Add to recent
|
||||||
Options.AddToRecentList(file,_T("Recent aud"));
|
Options.AddToRecentList(file,_T("Recent aud"));
|
||||||
|
|
||||||
|
// Update
|
||||||
|
UpdateImage();
|
||||||
|
Refresh(false);
|
||||||
}
|
}
|
||||||
catch (wxString &err) {
|
catch (wxString &err) {
|
||||||
wxMessageBox(err,_T("Error loading audio"),wxICON_ERROR | wxOK);
|
wxMessageBox(err,_T("Error loading audio"),wxICON_ERROR | wxOK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
loaded = (provider != NULL);
|
assert(loaded == (provider != NULL));
|
||||||
|
|
||||||
// Set default selection
|
// Set default selection
|
||||||
int n = grid->editBox->linen;
|
int n = grid->editBox->linen;
|
||||||
SetDialogue(grid,grid->GetDialogue(n),n);
|
SetDialogue(grid,grid->GetDialogue(n),n);
|
||||||
|
|
||||||
// Update
|
|
||||||
UpdateImage();
|
|
||||||
Refresh(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -809,40 +810,28 @@ int AudioDisplay::GetXAtSample(__int64 n) {
|
||||||
/////////////////
|
/////////////////
|
||||||
// Get MS from X
|
// Get MS from X
|
||||||
int AudioDisplay::GetMSAtX(__int64 x) {
|
int AudioDisplay::GetMSAtX(__int64 x) {
|
||||||
//fix me?
|
return (PositionSample+(x*samples)) * 1000 / provider->GetSampleRate();
|
||||||
if (provider)
|
|
||||||
return (PositionSample+(x*samples)) * 1000 / provider->GetSampleRate();
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/////////////////
|
/////////////////
|
||||||
// Get X from MS
|
// Get X from MS
|
||||||
int AudioDisplay::GetXAtMS(__int64 ms) {
|
int AudioDisplay::GetXAtMS(__int64 ms) {
|
||||||
//fix me?
|
return ((ms * provider->GetSampleRate() / 1000)-PositionSample)/samples;
|
||||||
if (provider)
|
|
||||||
return ((ms * provider->GetSampleRate() / 1000)-PositionSample)/samples;
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////
|
////////////////////
|
||||||
// Get MS At sample
|
// Get MS At sample
|
||||||
int AudioDisplay::GetMSAtSample(__int64 x) {
|
int AudioDisplay::GetMSAtSample(__int64 x) {
|
||||||
//fix me?
|
return x * 1000 / provider->GetSampleRate();
|
||||||
if (provider)
|
|
||||||
return x * 1000 / provider->GetSampleRate();
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////
|
////////////////////
|
||||||
// Get Sample at MS
|
// Get Sample at MS
|
||||||
__int64 AudioDisplay::GetSampleAtMS(__int64 ms) {
|
__int64 AudioDisplay::GetSampleAtMS(__int64 ms) {
|
||||||
//fix me?
|
return ms * provider->GetSampleRate() / 1000;
|
||||||
if (provider)
|
|
||||||
return ms * provider->GetSampleRate() / 1000;
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -191,7 +191,7 @@ int DialogProperties::SetInfoIfDifferent(wxString key,wxString value) {
|
||||||
//////////////////////////
|
//////////////////////////
|
||||||
// Set res to match video
|
// Set res to match video
|
||||||
void DialogProperties::OnSetFromVideo(wxCommandEvent &event) {
|
void DialogProperties::OnSetFromVideo(wxCommandEvent &event) {
|
||||||
ResX->SetValue(wxString::Format(_T("%i"),vid->provider->GetSourceWidth())); //fix me, null check?
|
ResX->SetValue(wxString::Format(_T("%i"),vid->provider->GetSourceWidth()));
|
||||||
ResY->SetValue(wxString::Format(_T("%i"),vid->provider->GetSourceHeight())); //fix me, identical to other set?
|
ResY->SetValue(wxString::Format(_T("%i"),vid->provider->GetSourceHeight()));
|
||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
|
@ -232,7 +232,7 @@ void DialogResample::OnResample (wxCommandEvent &event) {
|
||||||
/////////////////////////////////////////
|
/////////////////////////////////////////
|
||||||
// Get destination resolution from video
|
// Get destination resolution from video
|
||||||
void DialogResample::OnGetDestRes (wxCommandEvent &event) {
|
void DialogResample::OnGetDestRes (wxCommandEvent &event) {
|
||||||
ResX->SetValue(wxString::Format(_T("%i"),vid->provider->GetSourceWidth())); //fix me, null check?
|
ResX->SetValue(wxString::Format(_T("%i"),vid->provider->GetSourceWidth()));
|
||||||
ResY->SetValue(wxString::Format(_T("%i"),vid->provider->GetSourceHeight()));
|
ResY->SetValue(wxString::Format(_T("%i"),vid->provider->GetSourceHeight()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -512,9 +512,6 @@ void FrameMain::LoadSubtitles (wxString filename,wxString charset) {
|
||||||
// Sync
|
// Sync
|
||||||
SynchronizeProject(true);
|
SynchronizeProject(true);
|
||||||
|
|
||||||
// Update video
|
|
||||||
//videoBox->videoDisplay->SetSubtitles(filename); //fix me, remove?
|
|
||||||
|
|
||||||
// Update title bar
|
// Update title bar
|
||||||
UpdateTitle();
|
UpdateTitle();
|
||||||
}
|
}
|
||||||
|
@ -549,7 +546,6 @@ bool FrameMain::SaveSubtitles(bool saveas,bool withCharset) {
|
||||||
|
|
||||||
// Save
|
// Save
|
||||||
try {
|
try {
|
||||||
//videoBox->videoDisplay->SetSubtitles(filename); fix me, remove?
|
|
||||||
AssFile::top->Save(filename,true,true,charset);
|
AssFile::top->Save(filename,true,true,charset);
|
||||||
UpdateTitle();
|
UpdateTitle();
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,7 +127,6 @@ PClip VideoProvider::OpenVideo(wxString _filename, bool &usedDirectshow, bool mp
|
||||||
const char *argnames[2] = { 0, "audio" };
|
const char *argnames[2] = { 0, "audio" };
|
||||||
AVSValue args[2] = { videoFilename, false };
|
AVSValue args[2] = { videoFilename, false };
|
||||||
script = env->Invoke("AviSource", AVSValue(args,2), argnames);
|
script = env->Invoke("AviSource", AVSValue(args,2), argnames);
|
||||||
//fix me, check for video?
|
|
||||||
} catch (AvisynthError &) {
|
} catch (AvisynthError &) {
|
||||||
goto directshowOpen;
|
goto directshowOpen;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue