allow playing of streams through SoundsPlex system

This commit is contained in:
Adam Jensen 2023-02-22 18:23:46 +00:00
parent 2ab24e06d6
commit 7098cb0783
5 changed files with 76 additions and 9 deletions

View File

@ -8,6 +8,7 @@ target_sources(dxhr PRIVATE
SoundPlex.cpp SoundPlex.cpp
SoundPlexAssignment.cpp SoundPlexAssignment.cpp
SoundPlexChoiceList.cpp SoundPlexChoiceList.cpp
SoundPlexStream.cpp
SoundPlexWave.cpp SoundPlexWave.cpp
Voice.cpp Voice.cpp
snd.cpp) snd.cpp)

View File

@ -257,8 +257,12 @@ void buildUI(dtp::SoundPlex *snd, std::string indent) {
break; break;
} }
case dtp::SoundPlex::SoundPlexSelector_Stream: // 4 case dtp::SoundPlex::SoundPlexSelector_Stream: { // 4
auto *data = (dtp::SoundPlex::Stream *)snd->m_data;
ImGui::SameLine();
ImGui::Text("%s", data->m_streamName);
break; break;
}
case dtp::SoundPlex::SoundPlexSelector_Assignment: { // 5 case dtp::SoundPlex::SoundPlexSelector_Assignment: { // 5
auto *data = (dtp::SoundPlex::Assignment*)snd->m_data; auto *data = (dtp::SoundPlex::Assignment*)snd->m_data;

View File

@ -0,0 +1,54 @@
#include <cstdio>
#include "Sample.h"
#include "SoundPlexStream.h"
namespace cdc {
SoundPlexStream::SoundPlexStream(
void *data,
Controls *controls,
Controls3d *controls3d,
SoundOwner *owner)
:
SoundPlexSingleChild(controls, controls3d, owner)
{
dtpStream = (dtp::SoundPlex::Stream *)data;
m_state &= ~15;
m_state |= 1;
// TODO
}
uint32_t SoundPlexStream::Init() {
printf("SoundPlexStream::Init this=%p, dtpStream=%p, name=%s\n", this, dtpStream, dtpStream ? dtpStream->m_streamName : nullptr);
// TODO
multiplexStream = MultiplexStreamImpl::CreateSoundStream(
dtpStream->m_streamName,
dtpStream->m_priorityStream
// TODO
);
// HACK
((MultiplexStreamImpl*)multiplexStream)->hackSample->Play();
m_state &= ~0xD;
m_state |= 0x12;
return true;
}
SoundPlex *SoundPlexStream::Update(float) {
// TODO
if ((m_state & 0xF) == 1) {
// TODO
Init();
}
return nullptr;
}
void SoundPlexStream::End(EndType) {
// TODO
}
}

View File

@ -1,23 +1,24 @@
#pragma once #pragma once
#include "cdc/dtp/soundplex.h"
#include "SoundPlex.h" #include "SoundPlex.h"
#include "MultiplexStream.h"
namespace cdc { namespace cdc {
class SoundPlexStream : public SoundPlexSingleChild { class SoundPlexStream : public SoundPlexSingleChild {
MultiplexStream *multiplexStream = nullptr; // 18
dtp::SoundPlex::Stream *dtpStream = nullptr; // 24
public: public:
SoundPlexStream( SoundPlexStream(
void *data, void *data,
Controls *controls, Controls *controls,
Controls3d *controls3d, Controls3d *controls3d,
SoundOwner *owner) SoundOwner *owner);
:
SoundPlexSingleChild(controls, controls3d, owner)
{
// TODO
}
SoundPlex *Update(float) override { /*TODO*/ return nullptr; } uint32_t Init();
void End(EndType) override { /*TODO*/ } SoundPlex *Update(float) override;
void End(EndType) override;
}; };
} }

View File

@ -38,6 +38,13 @@ struct SoundPlex {
uint32_t m_counter; // 10 uint32_t m_counter; // 10
}; };
struct Stream { // compare with dtp::Multiplex
const char *m_streamName;
int8_t byte4; // TODO
int8_t m_priorityStream;
// TODO
};
struct Wave { struct Wave {
uint32_t m_id; uint32_t m_id;
// TODO // TODO