{
}
+ ~SoundManagerPrivate()
+ {
+ std::vector<const char*>::iterator it;
+ for (it = _devices.begin(); it != _devices.end(); ++it) {
+ free((void*)*it);
+ }
+ _devices.clear();
+ _sample_groups.clear();
+ }
+
void init() {
_mtx64 = AAX::Matrix64();
}
sample_group_map _sample_groups;
- std::vector<std::string> _devices;
+ std::vector<const char*> _devices;
};
if (is_working())
stop();
- d->_sample_groups.clear();
}
// initialize the sound manager
d->_source_id = 0;
d->_sources.clear();
- AAX::AeonWave aax;
AAX::DSP dsp;
-
- const char* devname = _device_name.c_str();
- if (_device_name == "")
- devname = NULL; // use default device
- else
- {
+ if (!_device_name.empty()) {
// try non-default device
- aax = AAX::AeonWave(devname);
+ d->_aax = AAX::AeonWave(_device_name.c_str());
}
-
- if ((!devname)||(testForError(aax, "Audio device not available, trying default.")) ) {
- aax = AAX::AeonWave(AAX_MODE_WRITE_STEREO);
- if (testForError(aax, "Default audio device not available.") ) {
+ else
+ {
+ testForError(d->_aax, "Audio device not available, trying default.");
+ d->_aax = AAX::AeonWave(AAX_MODE_WRITE_STEREO);
+ if (testForError(d->_aax, "Default audio device not available.") ) {
return;
}
}
- d->_aax = aax;
d->init();
d->_aax.set(AAX_INITIALIZED);
+ testForError("initialization");
dsp = AAX::DSP(d->_aax, AAX_VOLUME_FILTER);
dsp.set(AAX_GAIN, 0.0f);
dsp.set(AAX_SOUND_VELOCITY, 340.3f);
d->_aax.set(dsp);
- testForError("listener initialization");
+ testForError("scenery setup");
- _vendor = d->_aax.info(AAX_VENDOR_STRING);
- _renderer = d->_aax.info(AAX_RENDERER_STRING);
+ _vendor = (const char *)d->_aax.info(AAX_VENDOR_STRING);
+ _renderer = (const char *)d->_aax.info(AAX_RENDERER_STRING);
#endif
}
vector<const char*> SGSoundMgr::get_available_devices()
{
- vector<const char*> devices;
#ifdef ENABLE_SOUND
std::string on = " on ";
std::string colon = ": ";
else if (r) name += on + r;
else if (i) name += colon + i;
- d->_devices.push_back(name);
- devices.push_back(name.c_str());
+ d->_devices.push_back( strdup(name.c_str()) );
}
}
}
#endif
- return devices;
+ return d->_devices;
}
#ifdef ENABLE_SOUND
enum aaxErrorType error = d->_aax.error_no();
if (error != AAX_ERROR_NONE) {
- SG_LOG( SG_SOUND, SG_ALERT, "AL Error (" << name << "): "
+ SG_LOG( SG_SOUND, SG_ALERT, "AeonWave Error (" << name << "): "
<< d->_aax.error(error) << " at " << s);
return true;
}