mirror of https://github.com/AxioDL/metaforce.git
Update audio integration
This commit is contained in:
parent
6301af3133
commit
42f7cbe4b5
|
@ -38,7 +38,7 @@ void ViewManager::BuildTestPART(urde::IObjectStore& objStore)
|
|||
testRSF.SyncRead(m_rsfBuf.get(), rsfLen);
|
||||
//CMoviePlayer::SetStaticAudio(m_rsfBuf.get(), rsfLen, 416480, 1973664);
|
||||
|
||||
m_videoVoice = m_voiceAllocator->allocateNewVoice(m_audioSet, 32000, &m_voiceCallback);
|
||||
m_videoVoice = m_voiceEngine->allocateNewStereoVoice(32000, &m_voiceCallback);
|
||||
m_videoVoice->start();
|
||||
|
||||
//m_rootView->accessContentViews().clear();
|
||||
|
@ -253,10 +253,7 @@ void ViewManager::init(boo::IApplication* app)
|
|||
|
||||
m_mainWindow->setWaitCursor(false);
|
||||
|
||||
m_voiceAllocator = boo::NewAudioVoiceAllocator();
|
||||
m_audioSet = m_voiceAllocator->getAvailableSet();
|
||||
m_stereoMatrix.setAudioChannelSet(m_audioSet);
|
||||
m_stereoMatrix.setDefaultMatrixCoefficients();
|
||||
m_voiceEngine = boo::NewAudioVoiceEngine();
|
||||
CGraphics::InitializeBoo(gf, m_mainWindow->getCommandQueue(), root->renderTex());
|
||||
CElementGen::Initialize();
|
||||
CMoviePlayer::Initialize();
|
||||
|
@ -305,7 +302,7 @@ bool ViewManager::proc()
|
|||
m_rootView->draw(gfxQ);
|
||||
CGraphics::EndScene();
|
||||
gfxQ->execute();
|
||||
m_voiceAllocator->pumpVoices();
|
||||
m_voiceEngine->pumpAndMixVoices();
|
||||
m_mainWindow->waitForRetrace();
|
||||
|
||||
return true;
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
#define URDE_VIEW_MANAGER_HPP
|
||||
|
||||
#include "hecl/CVarManager.hpp"
|
||||
#include "boo/audiodev/IAudioVoiceAllocator.hpp"
|
||||
#include "boo/audiodev/AudioMatrix.hpp"
|
||||
#include "boo/audiodev/IAudioVoiceEngine.hpp"
|
||||
#include "ProjectManager.hpp"
|
||||
#include "Space.hpp"
|
||||
|
||||
|
@ -52,22 +51,17 @@ class ViewManager : public specter::IViewManager
|
|||
std::unique_ptr<CLineRenderer> m_lineRenderer;
|
||||
std::unique_ptr<CMoviePlayer> m_moviePlayer;
|
||||
std::unique_ptr<u8[]> m_rsfBuf;
|
||||
std::unique_ptr<boo::IAudioVoiceAllocator> m_voiceAllocator;
|
||||
boo::AudioChannelSet m_audioSet = boo::AudioChannelSet::Unknown;
|
||||
std::unique_ptr<boo::IAudioVoiceEngine> m_voiceEngine;
|
||||
std::unique_ptr<boo::IAudioVoice> m_videoVoice;
|
||||
boo::AudioMatrixStereo m_stereoMatrix;
|
||||
struct AudioVoiceCallback : boo::IAudioVoiceCallback
|
||||
{
|
||||
ViewManager& m_vm;
|
||||
std::vector<s16> m_stereoBuf;
|
||||
void needsNextBuffer(boo::IAudioVoice& voice, size_t frames)
|
||||
size_t supplyAudio(boo::IAudioVoice& voice, size_t frames, int16_t* data)
|
||||
{
|
||||
m_stereoBuf.clear();
|
||||
m_stereoBuf.resize(frames * 2);
|
||||
if (m_vm.m_moviePlayer)
|
||||
m_vm.m_moviePlayer->MixAudio(m_stereoBuf.data(), nullptr, frames);
|
||||
CMoviePlayer::MixStaticAudio(m_stereoBuf.data(), m_stereoBuf.data(), frames);
|
||||
m_vm.m_stereoMatrix.bufferStereoSampleData(voice, m_stereoBuf.data(), frames);
|
||||
m_vm.m_moviePlayer->MixAudio(data, nullptr, frames);
|
||||
CMoviePlayer::MixStaticAudio(data, data, frames);
|
||||
return frames;
|
||||
}
|
||||
AudioVoiceCallback(ViewManager& vm) : m_vm(vm) {}
|
||||
} m_voiceCallback;
|
||||
|
|
|
@ -539,6 +539,7 @@ void CMoviePlayer::MixAudio(s16* out, const s16* in, u32 samples)
|
|||
tex = &x80_textures[xd4_audioSlot];
|
||||
thisSamples = std::min(tex->audioSamples - tex->playedSamples, samples);
|
||||
}
|
||||
|
||||
if (thisSamples)
|
||||
{
|
||||
/* mix samples with `in` or no mix */
|
||||
|
|
2
hecl
2
hecl
|
@ -1 +1 @@
|
|||
Subproject commit 420a3b078b9532f382028a3890fa47c7e870f0c8
|
||||
Subproject commit 40ff62ad7eacddecb1473ae00e7ce632f120486b
|
Loading…
Reference in New Issue