mirror of
https://github.com/PabloMK7/citra.git
synced 2025-09-10 12:50:04 +00:00
AudioCore/HLE/source: Partially implement last_buffer_id (#7397)
* AudioCore/HLE/source: Partially implement last_buffer_id shared_memory.h: fix typo * tests\audio_core\hle\source.cpp: Add test cases to verify last_buffer_id
This commit is contained in:
parent
106364e01e
commit
aa6a29d7e1
5 changed files with 388 additions and 4 deletions
|
@ -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 when all buffers in the queue finish playing
|
||||
};
|
||||
|
||||
Status status[num_sources];
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -143,7 +143,8 @@ private:
|
|||
// buffer_id state
|
||||
|
||||
bool buffer_update = false;
|
||||
u32 current_buffer_id = 0;
|
||||
u16 last_buffer_id = 0;
|
||||
u16 current_buffer_id = 0;
|
||||
|
||||
// Decoding state
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue