Skip to content
This repository has been archived by the owner on Mar 5, 2024. It is now read-only.

Commit

Permalink
AudioCore/HLE/source: Partially implement last_buffer_id
Browse files Browse the repository at this point in the history
  • Loading branch information
SachinVin committed Jan 28, 2024
1 parent d1e3ddd commit 3b4bb41
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/audio_core/hle/shared_memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ struct SourceStatus {
u16_le sync_count; ///< Is set by the DSP to the value of SourceConfiguration::sync_count
u32_dsp buffer_position; ///< Number of samples into the current buffer
u16_le current_buffer_id; ///< Updated when a buffer finishes playing
INSERT_PADDING_DSPWORDS(1);
u16_le last_buffer_id; ///< Updated all buffers in the quieue finished playing
};

Status status[num_sources];
Expand Down
7 changes: 5 additions & 2 deletions src/audio_core/hle/source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ void Source::GenerateFrame() {
if (state.current_buffer.empty() && !DequeueBuffer()) {
state.enabled = false;
state.buffer_update = true;
state.last_buffer_id = state.current_buffer_id;
state.current_buffer_id = 0;
return;
}
Expand Down Expand Up @@ -411,6 +412,7 @@ bool Source::DequeueBuffer() {
state.next_sample_number = state.current_sample_number;
state.current_buffer_physical_address = buf.physical_address;
state.current_buffer_id = buf.buffer_id;
state.last_buffer_id = 0;
state.buffer_update = buf.from_queue && !buf.has_played;

if (buf.is_looping) {
Expand All @@ -432,9 +434,10 @@ SourceStatus::Status Source::GetCurrentStatus() {
ret.is_enabled = state.enabled;
ret.current_buffer_id_dirty = state.buffer_update ? 1 : 0;
state.buffer_update = false;
ret.current_buffer_id = state.current_buffer_id;
ret.buffer_position = state.current_sample_number;
ret.sync_count = state.sync_count;
ret.buffer_position = state.current_sample_number;
ret.current_buffer_id = state.current_buffer_id;
ret.last_buffer_id = state.last_buffer_id;

return ret;
}
Expand Down
3 changes: 2 additions & 1 deletion src/audio_core/hle/source.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ class Source final {
// buffer_id state

bool buffer_update = false;
u32 current_buffer_id = 0;
u16 last_buffer_id = 0;
u16 current_buffer_id = 0;

// Decoding state

Expand Down

0 comments on commit 3b4bb41

Please sign in to comment.