|
From: <pst...@us...> - 2010-07-18 22:05:50
|
Revision: 823
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=823&view=rev
Author: pstieber
Date: 2010-07-18 22:05:43 +0000 (Sun, 18 Jul 2010)
Log Message:
-----------
1. Added end-of-file checks.
2. Fixed the code to set the sample file name. The old code was only setting the value using
the path, not the complete file name.
Modified Paths:
--------------
trunk/jazz/src/Audio.cpp
Modified: trunk/jazz/src/Audio.cpp
===================================================================
--- trunk/jazz/src/Audio.cpp 2010-07-18 22:04:00 UTC (rev 822)
+++ trunk/jazz/src/Audio.cpp 2010-07-18 22:05:43 UTC (rev 823)
@@ -292,11 +292,15 @@
ifstream Is(FileName.c_str());
int Version;
Is >> Version >> mSamplingRate >> mChannelCount >> mSoftwareSynchonization;
- while (Is)
+ while (Is && !Is.eof())
{
int key, pan, vol, pitch;
wxFileName SampleFileName;
Is >> key;
+ if (Is.fail())
+ {
+ break;
+ }
string FileNameString;
ReadString(Is, FileNameString);
SampleFileName.Assign(FileNameString);
@@ -321,7 +325,7 @@
continue;
}
assert(0 <= key && key < eSampleCount);
- mSamples[key]->SetFileName(SplFilePath.c_str());
+ mSamples[key]->SetFileName(SampleFileName.GetFullPath().c_str());
mSamples[key]->SetLabel(Label.c_str());
mSamples[key]->SetVolume(vol);
mSamples[key]->SetPan(pan);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|