duckstation

duckstation, but archived from the revision just before upstream changed it to a proprietary software project, this version is the libre one
git clone https://git.neptards.moe/u3shit/duckstation.git
Log | Files | Refs | README | LICENSE

spu.h (1111B)


      1 // SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
      2 // SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
      3 
      4 #pragma once
      5 
      6 #include "types.h"
      7 
      8 #include <array>
      9 
     10 class StateWrapper;
     11 
     12 class AudioStream;
     13 
     14 namespace SPU {
     15 
     16 enum : u32
     17 {
     18   RAM_SIZE = 512 * 1024,
     19   RAM_MASK = RAM_SIZE - 1,
     20   SAMPLE_RATE = 44100,
     21 };
     22 
     23 void Initialize();
     24 void CPUClockChanged();
     25 void Shutdown();
     26 void Reset();
     27 bool DoState(StateWrapper& sw);
     28 
     29 u16 ReadRegister(u32 offset);
     30 void WriteRegister(u32 offset, u16 value);
     31 
     32 void DMARead(u32* words, u32 word_count);
     33 void DMAWrite(const u32* words, u32 word_count);
     34 
     35 // Render statistics debug window.
     36 void DrawDebugStateWindow();
     37 
     38 // Executes the SPU, generating any pending samples.
     39 void GeneratePendingSamples();
     40 
     41 /// Access to SPU RAM.
     42 const std::array<u8, RAM_SIZE>& GetRAM();
     43 std::array<u8, RAM_SIZE>& GetWritableRAM();
     44 
     45 /// Change output stream - used for runahead.
     46 // TODO: Make it use system "running ahead" flag
     47 bool IsAudioOutputMuted();
     48 void SetAudioOutputMuted(bool muted);
     49 
     50 AudioStream* GetOutputStream();
     51 void RecreateOutputStream();
     52 
     53 }; // namespace SPU