XMLSound: Avoid using exceptions for missing file
Reducing how noisy our exception reporting is, by using simple return value from SGXMLSound::init.
This commit is contained in:
parent
a5dd5cdc80
commit
77786e8e9b
@ -84,7 +84,7 @@ SGXmlSound::~SGXmlSound()
|
|||||||
_pitch.clear();
|
_pitch.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
bool
|
||||||
SGXmlSound::init( SGPropertyNode *root,
|
SGXmlSound::init( SGPropertyNode *root,
|
||||||
SGPropertyNode *node,
|
SGPropertyNode *node,
|
||||||
SGSampleGroup *sgrp,
|
SGSampleGroup *sgrp,
|
||||||
@ -315,8 +315,8 @@ SGXmlSound::init( SGPropertyNode *root,
|
|||||||
string soundFileStr = node->getStringValue("path", "");
|
string soundFileStr = node->getStringValue("path", "");
|
||||||
_sample = new SGSoundSample(soundFileStr.c_str(), path);
|
_sample = new SGSoundSample(soundFileStr.c_str(), path);
|
||||||
if (!_sample->file_path().exists()) {
|
if (!_sample->file_path().exists()) {
|
||||||
throw sg_io_exception("XML sound: couldn't find file: '" + soundFileStr + "'");
|
SG_LOG(SG_SOUND, SG_WARN, "XML sound: couldn't find file: '" + soundFileStr + "'");
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
_sample->set_relative_position( offset_pos );
|
_sample->set_relative_position( offset_pos );
|
||||||
@ -328,6 +328,8 @@ SGXmlSound::init( SGPropertyNode *root,
|
|||||||
_sample->set_volume( v );
|
_sample->set_volume( v );
|
||||||
_sample->set_pitch( p );
|
_sample->set_pitch( p );
|
||||||
_sgrp->add( _sample, _name );
|
_sgrp->add( _sample, _name );
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -107,7 +107,7 @@ public:
|
|||||||
* @param avionics A pointer to the pre-initialized avionics sample group.
|
* @param avionics A pointer to the pre-initialized avionics sample group.
|
||||||
* @param path The path where the audio files remain.
|
* @param path The path where the audio files remain.
|
||||||
*/
|
*/
|
||||||
virtual void init( SGPropertyNode *root,
|
virtual bool init( SGPropertyNode *root,
|
||||||
SGPropertyNode *child,
|
SGPropertyNode *child,
|
||||||
SGSampleGroup *sgrp,
|
SGSampleGroup *sgrp,
|
||||||
SGSampleGroup *avionics,
|
SGSampleGroup *avionics,
|
||||||
|
Loading…
Reference in New Issue
Block a user