Fix ram audio provider (this stubs out a few lines used for progress updating.

Originally committed to SVN as r5307.
This commit is contained in:
Amar Takhar 2011-02-06 18:48:42 +00:00
parent 2ce135b612
commit 15dab81b91
3 changed files with 19 additions and 11 deletions

View File

@ -29,6 +29,7 @@ SRC = \
audio/convert.cpp \
audio/dummy_audio.cpp \
audio/pcm.cpp \
cache/audio_ram.cpp \
$(SRC_OPT)
HEADERS = \

View File

@ -36,12 +36,13 @@
#include "config.h"
#include "audio_provider_ram.h"
#include "dialog_progress.h"
#include "frame_main.h"
#include "main.h"
#include "utils.h"
#include "audio_ram.h"
//#include "dialog_progress.h"
//#include "frame_main.h"
//#include "main.h"
//#include "utils.h"
namespace media {
/// DOCME
#define CacheBits ((22))
@ -86,16 +87,17 @@ RAMAudioProvider::RAMAudioProvider(AudioProvider *src) {
filename = source->GetFilename();
// Start progress
//XXX fixme:
volatile bool canceled = false;
DialogProgress *progress = new DialogProgress(AegisubApp::Get()->frame,_("Load audio"),&canceled,_("Reading into RAM"),0,source->GetNumSamples());
progress->Show();
progress->SetProgress(0,1);
// DialogProgress *progress = new DialogProgress(AegisubApp::Get()->frame,_("Load audio"),&canceled,_("Reading into RAM"),0,source->GetNumSamples());
// progress->Show();
// progress->SetProgress(0,1);
// Read cache
int readsize = CacheBlockSize / source->GetBytesPerSample();
for (int i=0;i<blockcount && !canceled; i++) {
source->GetAudio((char*)blockcache[i],i*readsize, i == blockcount-1 ? (source->GetNumSamples() - i*readsize) : readsize);
progress->SetProgress(i,blockcount-1);
// progress->SetProgress(i,blockcount-1);
}
// Clean up progress
@ -103,7 +105,7 @@ RAMAudioProvider::RAMAudioProvider(AudioProvider *src) {
Clear();
throw agi::UserCancelException("Audio loading cancelled by user");
}
progress->Destroy();
// progress->Destroy();
}
/// @brief Destructor
@ -173,3 +175,5 @@ void RAMAudioProvider::GetAudio(void *buf, int64_t start, int64_t count) const {
}
}
}
} // namespace media

View File

@ -34,8 +34,9 @@
/// @ingroup audio_input
///
#include "include/aegisub/audio_provider.h"
#include "libmedia/audio.h"
namespace media {
/// DOCME
/// @class RAMAudioProvider
/// @brief DOCME
@ -60,3 +61,5 @@ public:
bool AreSamplesNativeEndian() const { return samples_native_endian; }
void GetAudio(void *buf, int64_t start, int64_t count) const;
};
} // namespace media