Siren audio engine in progress

Added HRTF (Kemar) samples for 3d spatialization
Exposed frame buffer width and height for camera renderFrame calls.
Fixed a bug that caused objects containing a mixture of both opaque and transparent materials to be rendered entirely in the transparent render pass.  Now the sub meshes are evaluated independently.
This commit is contained in:
2013-02-08 17:28:17 -08:00
parent 63d333ae46
commit 743955fbe0
19 changed files with 264 additions and 89 deletions

View File

@@ -54,6 +54,8 @@ KRAudioSource::KRAudioSource(KRScene &scene, std::string name) : KRNode(scene, n
m_rolloffFactor = 2.0f;
m_enable_occlusion = true;
m_enable_obstruction = true;
m_start_audio_frame = -1;
}
KRAudioSource::~KRAudioSource()
@@ -394,6 +396,7 @@ void KRAudioSource::physicsUpdate(float deltaTime)
void KRAudioSource::play()
{
KRAudioManager *audioManager = getContext().getAudioManager();
m_start_audio_frame = audioManager->getAudioFrame();
audioManager->activateAudioSource(this);
if(audioManager->getAudioEngine() == KRAudioManager::KRAKEN_AUDIO_OPENAL) {
getContext().getAudioManager()->makeCurrentContext();
@@ -417,6 +420,7 @@ void KRAudioSource::play()
void KRAudioSource::stop()
{
m_start_audio_frame = -1;
m_playing = false;
getContext().getAudioManager()->deactivateAudioSource(this);
}
@@ -437,6 +441,14 @@ std::string KRAudioSource::getSample()
return m_audio_sample_name;
}
KRAudioSample *KRAudioSource::getAudioSample()
{
if(m_audioFile == NULL && m_audio_sample_name.size() != 0) {
m_audioFile = getContext().getAudioManager()->get(m_audio_sample_name);
}
return m_audioFile;
}
void KRAudioSource::updatePosition()
{
if(m_is3d) {
@@ -487,6 +499,11 @@ int KRAudioSource::getBufferFrame()
return m_currentBufferFrame;
}
__int64_t KRAudioSource::getStartAudioFrame()
{
return m_start_audio_frame;
}
OSStatus alcASASetSourceProc(const ALuint property, ALuint source, ALvoid *data, ALuint dataSize)
{
OSStatus err = noErr;