[XAM] XMP: Implement playback

This commit is contained in:
Hendi
2024-10-15 00:56:13 +02:00
committed by Radosław Gliński
parent 5a76cac218
commit 764f230dd9
3 changed files with 295 additions and 10 deletions

View File

@@ -11,6 +11,7 @@
#define XENIA_KERNEL_XAM_APPS_XMP_APP_H_
#include <memory>
#include <mutex>
#include <string>
#include <unordered_map>
#include <vector>
@@ -19,6 +20,8 @@
#include "xenia/kernel/kernel_state.h"
#include "xenia/kernel/xam/app_manager.h"
#include "xenia/apu/audio_driver.h"
namespace xe {
namespace kernel {
namespace xam {
@@ -93,6 +96,8 @@ class XmpApp : public App {
private:
void OnStateChanged();
void WorkerThreadMain();
bool PlayFile(std::string_view filename);
State state_;
PlaybackClient playback_client_;
@@ -107,6 +112,14 @@ class XmpApp : public App {
std::unordered_map<uint32_t, Playlist*> playlists_;
uint32_t next_playlist_handle_;
uint32_t next_song_handle_;
std::atomic<bool> worker_running_ = {false};
std::unique_ptr<xe::threading::Thread> worker_thread_;
bool paused_ = true;
xe::threading::Fence resume_fence_; // Signaled when resume requested.
std::mutex driver_mutex_ = {};
xe::apu::AudioDriver* driver_ = nullptr;
};
} // namespace apps