}
// add a sound effect, return true if successful
-bool SGSampleGroup::add( SGSoundSample *sound, const string& refname ) {
+bool SGSampleGroup::add( SGSharedPtr<SGSoundSample> sound, const string& refname ) {
sample_map_iterator sample_it = _samples.find( refname );
if ( sample_it != _samples.end() ) {
using std::map;
using std::string;
-typedef SGSharedPtr<SGSoundSample> SGSoundSample_ptr;
-typedef map < string, SGSoundSample_ptr > sample_map;
+typedef map < string, SGSharedPtr<SGSoundSample> > sample_map;
typedef sample_map::iterator sample_map_iterator;
typedef sample_map::const_iterator const_sample_map_iterator;
* @param refname Name of this audio sample for reference purposes
* @return return true if successful
*/
- bool add( SGSoundSample *sound, const string& refname );
+ bool add( SGSharedPtr<SGSoundSample> sound, const string& refname );
/**
* Remove an audio sample from this group.
SGGeod _position;
sample_map _samples;
- std::vector<SGSoundSample_ptr> _removed_samples;
+ std::vector< SGSharedPtr<SGSoundSample> > _removed_samples;
bool testForALError(string s);
bool testForError(void *p, string s);
_is_file(false)
{
SG_LOG( SG_GENERAL, SG_DEBUG, "In memory sounds sample" );
- _data = (unsigned char*)data; *data = NULL;
+ _data = (unsigned char*)*data; *data = NULL;
}
// constructor
_is_file(false)
{
SG_LOG( SG_GENERAL, SG_DEBUG, "In memory sounds sample" );
- _data = (unsigned char*)data; *data = NULL;
+ _data = (unsigned char*)*data; *data = NULL;
}
_free_sources.pop_back();
_sources_in_use.push_back(source);
}
+ else
+ SG_LOG( SG_GENERAL, SG_INFO, "No more free sources available\n");
return source;
}
}
}
}
- else
+ else {
buffer = sample->get_buffer();
+}
return buffer;
}