Adding Music Playback

This commit is contained in:
IlyaShurupov 2023-11-29 19:42:17 +03:00 committed by Ilya Shurupov
parent a233b6a214
commit b74c5bc5e5
12 changed files with 1840 additions and 149 deletions

View file

@ -1,29 +1,29 @@
#pragma once
#include <iostream>
#include <thread>
#include <alsa/asoundlib.h>
#include "Common.hpp"
class WavPlayer {
class MusicPlayerContext;
typedef tp::ualni SongId;
class TrackPlayer {
public:
WavPlayer();
~WavPlayer();
TrackPlayer();
~TrackPlayer();
void loadSong(const char* filePath);
void playSong();
void stopSong();
void setVolume(float volume);
float getProgress() const;
float getDurationSec() const;
void setProgress(float newProgress);
void startStreamTrack(SongId id);
void playSong();
void stopSong();
void setVolume(float volume);
float getProgress() const;
float getDurationSec() const;
void setProgress(float newProgress);
private:
void playbackThreadFunction();
snd_pcm_t* handle;
std::thread* playbackThread;
bool isPlaying;
float progress;
};
void example();
MusicPlayerContext* mContext;
};

File diff suppressed because it is too large Load diff