Modules/LibraryViewer/public/WavPlayer.hpp
2024-11-24 22:41:12 +03:00

29 lines
No EOL
527 B
C++

#pragma once
#include <iostream>
#include <thread>
#include <alsa/asoundlib.h>
class WavPlayer {
public:
WavPlayer();
~WavPlayer();
void loadSong(const char* filePath);
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();