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/convert.cpp \
audio/dummy_audio.cpp \ audio/dummy_audio.cpp \
audio/pcm.cpp \ audio/pcm.cpp \
cache/audio_ram.cpp \
$(SRC_OPT) $(SRC_OPT)
HEADERS = \ HEADERS = \

View file

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