Adding Music Playback
This commit is contained in:
parent
7b325244c5
commit
231b30b2cb
12 changed files with 1840 additions and 149 deletions
|
|
@ -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;
|
||||
};
|
||||
1587
LibraryViewer/public/wav_file_reader.h
Normal file
1587
LibraryViewer/public/wav_file_reader.h
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue