diff --git a/cdcSound/CMakeLists.txt b/cdcSound/CMakeLists.txt index d799f56..c271ff1 100644 --- a/cdcSound/CMakeLists.txt +++ b/cdcSound/CMakeLists.txt @@ -8,6 +8,7 @@ target_sources(dxhr PRIVATE SoundPlex.cpp SoundPlexAssignment.cpp SoundPlexChoiceList.cpp + SoundPlexStream.cpp SoundPlexWave.cpp Voice.cpp snd.cpp) diff --git a/cdcSound/SoundPlex.cpp b/cdcSound/SoundPlex.cpp index 1d0e084..938382f 100644 --- a/cdcSound/SoundPlex.cpp +++ b/cdcSound/SoundPlex.cpp @@ -257,8 +257,12 @@ void buildUI(dtp::SoundPlex *snd, std::string indent) { 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; + } case dtp::SoundPlex::SoundPlexSelector_Assignment: { // 5 auto *data = (dtp::SoundPlex::Assignment*)snd->m_data; diff --git a/cdcSound/SoundPlexStream.cpp b/cdcSound/SoundPlexStream.cpp new file mode 100644 index 0000000..b45e929 --- /dev/null +++ b/cdcSound/SoundPlexStream.cpp @@ -0,0 +1,54 @@ +#include +#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 +} + +} diff --git a/cdcSound/SoundPlexStream.h b/cdcSound/SoundPlexStream.h index 304d5b8..60b92cb 100644 --- a/cdcSound/SoundPlexStream.h +++ b/cdcSound/SoundPlexStream.h @@ -1,23 +1,24 @@ #pragma once +#include "cdc/dtp/soundplex.h" #include "SoundPlex.h" +#include "MultiplexStream.h" namespace cdc { class SoundPlexStream : public SoundPlexSingleChild { + MultiplexStream *multiplexStream = nullptr; // 18 + dtp::SoundPlex::Stream *dtpStream = nullptr; // 24 + public: SoundPlexStream( void *data, Controls *controls, Controls3d *controls3d, - SoundOwner *owner) - : - SoundPlexSingleChild(controls, controls3d, owner) - { - // TODO - } + SoundOwner *owner); - SoundPlex *Update(float) override { /*TODO*/ return nullptr; } - void End(EndType) override { /*TODO*/ } + uint32_t Init(); + SoundPlex *Update(float) override; + void End(EndType) override; }; } diff --git a/eventually_generated/cdc/dtp/soundplex.h b/eventually_generated/cdc/dtp/soundplex.h index c375908..7533ecb 100644 --- a/eventually_generated/cdc/dtp/soundplex.h +++ b/eventually_generated/cdc/dtp/soundplex.h @@ -38,6 +38,13 @@ struct SoundPlex { 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 { uint32_t m_id; // TODO