Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ class LoadFullRateMismatchTest : public UnitTest{

virtual UnitTestResult run(Logger& logger, CancellableScope& scope) const override{
const std::vector<int16_t> samples = {0, 1, 0, 1};
const std::string path = temp_wav_path("s16_44100_2ch");
const std::string path = temp_wav_path("s16_44100_2ch_rate_mismatch");
write_wav_file(path, 1, 2, 44100, 16, to_bytes(samples));

QAudioFormat target;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ StreamHistorySession::StreamHistorySession(Logger& logger)
// The working-stream nominal shape is metadata only: the pair's
// per-listener forwarder carries the shape actually requested, and
// nothing validates this one.
: AudioFloatStreamListener(1)
, Kernels::AudioPipeline::WorkingAudioStreamListener(48000, 2)
: Kernels::AudioPipeline::WorkingAudioStreamListener(48000, 2)
, m_data(CONSTRUCT_TOKEN, logger)
{}
void StreamHistorySession::start(AudioChannelFormat format, bool has_video){
Expand Down Expand Up @@ -114,13 +113,6 @@ bool StreamHistorySession::save(const std::string& filename) const{

return tracker->save(filename);
}
void StreamHistorySession::on_samples(const float* samples, size_t frames){
Data& data = *m_data;
WriteSpinLock lg(data.m_lock);
if (data.m_current){
data.m_current->on_samples(samples, frames);
}
}
void StreamHistorySession::push_samples(size_t samples, size_t stride, const float* data){
Data& state = *m_data;
WriteSpinLock lg(state.m_lock);
Expand Down Expand Up @@ -177,42 +169,35 @@ void StreamHistorySession::initialize(){
// stream shape (what the tree delivers through the working listener),
// not the preset's legacy framing. (DUAL_44100 was previously
// misreported as mono; MONO_96000 was previously framed as 2-sample
// frames at 48000.) "expected_samples_per_frame" keeps the legacy
// framing values for the AudioFloatStreamListener path.
// frames at 48000.)
switch (data.m_audio_format){
case AudioChannelFormat::NONE:
expected_samples_per_frame = 0;
data.m_active_channels = 0;
data.m_active_rate = 0;
data.m_current.reset(new StreamHistoryTracker(data.m_logger, data.m_window, 0, 0, data.m_has_video));
return;
case AudioChannelFormat::MONO_48000:
expected_samples_per_frame = 1;
data.m_active_channels = 1;
data.m_active_rate = 48000;
data.m_current.reset(new StreamHistoryTracker(data.m_logger, data.m_window, 1, 48000, data.m_has_video));
return;
case AudioChannelFormat::DUAL_44100:
expected_samples_per_frame = 2;
data.m_active_channels = 2;
data.m_active_rate = 44100;
data.m_current.reset(new StreamHistoryTracker(data.m_logger, data.m_window, 2, 44100, data.m_has_video));
return;
case AudioChannelFormat::DUAL_48000:
expected_samples_per_frame = 2;
data.m_active_channels = 2;
data.m_active_rate = 48000;
data.m_current.reset(new StreamHistoryTracker(data.m_logger, data.m_window, 2, 48000, data.m_has_video));
return;
case AudioChannelFormat::MONO_96000:
expected_samples_per_frame = 2;
data.m_active_channels = 1;
data.m_active_rate = 96000;
data.m_current.reset(new StreamHistoryTracker(data.m_logger, data.m_window, 1, 96000, data.m_has_video));
return;
case AudioChannelFormat::INTERLEAVE_LR_96000:
case AudioChannelFormat::INTERLEAVE_RL_96000:
expected_samples_per_frame = 2;
data.m_active_channels = 2;
data.m_active_rate = 48000;
data.m_current.reset(new StreamHistoryTracker(data.m_logger, data.m_window, 2, 48000, data.m_has_video));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ namespace PokemonAutomation{


class StreamHistorySession
: public AudioFloatStreamListener
, public Kernels::AudioPipeline::WorkingAudioStreamListener
: public Kernels::AudioPipeline::WorkingAudioStreamListener
, public VideoFrameListener
, public AudioSession::StateListener
, public VideoSession::StateListener
Expand All @@ -36,9 +35,6 @@ class StreamHistorySession
void set_audio_session(AudioSession& session);

public:
// Legacy float stream (kept until the remaining float consumers
// migrate; see the audio pipeline hand-off doc).
virtual void on_samples(const float* data, size_t frames) override;
// Working stream, delivered in the shape requested at attach time
// (the active preset's physical shape), split (planar) channels.
virtual void push_samples(size_t samples, size_t stride, const float* data) override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ bool ConsoleSystemSession::try_shutdown() noexcept{

m_video.remove_state_listener(m_history);
m_video.remove_state_listener(m_history);
m_audio.remove_stream_listener(m_history);
m_audio.remove_working_stream_listener(m_history);
m_audio.remove_state_listener(m_history);

Expand Down Expand Up @@ -88,7 +87,6 @@ ConsoleSystemSession::ConsoleSystemSession(
m_overlay.add_stat(*m_main_thread_utilization);

m_audio.add_state_listener(m_history);
m_audio.add_stream_listener(m_history);
m_video.add_state_listener(m_history);
m_video.add_frame_listener(m_history);

Expand Down
Loading