forked from NTUT-FUCK-PTSD/Fuck-PTSD
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
126 additions
and
724 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#ifndef MUSIC_PLAYER_H | ||
#define MUSIC_PLAYER_H | ||
|
||
#include <string> | ||
|
||
#include "soloud.h" | ||
#include "soloud_speech.h" | ||
#include "soloud_thread.h" | ||
#include "soloud_wav.h" | ||
|
||
namespace Music { | ||
class Player { | ||
public: | ||
static void Init(); | ||
|
||
static void PlayMusic(const std::string& path, bool loop = false); | ||
static void PlayMusic( | ||
const std::string& path, | ||
bool loop, | ||
float volume, | ||
float speed | ||
); | ||
|
||
static void StopMusic(); | ||
|
||
static void Shutdown(); | ||
|
||
static void SetVolume(float volume); | ||
|
||
static void SetSpeed(float speed); | ||
|
||
private: | ||
static SoLoud::Soloud m_MusicSystem; | ||
static std::shared_ptr<SoLoud::Wav> m_Wav; | ||
static SoLoud::Speech m_Speech; | ||
static SoLoud::handle m_MusicHandle; | ||
}; | ||
} // namespace Music | ||
|
||
#endif // MUSIC_PLAYER_H |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +0,0 @@ | ||
// | ||
// Created by adven on 2024/3/27. | ||
// | ||
|
||
#ifndef FUCK_PTSD_TEMPO_H | ||
#define FUCK_PTSD_TEMPO_H | ||
|
||
#include <fstream> | ||
#include <iostream> | ||
#include <sstream> | ||
#include <string> | ||
#include <vector> | ||
|
||
#include "Util/Logger.hpp" | ||
|
||
namespace Music { | ||
class Tempo final { | ||
public: | ||
explicit Tempo(); | ||
~Tempo(); | ||
|
||
// must read one line in file, it not be '\n' | ||
void readTempoFile(const std::string& txtFilePath); | ||
|
||
bool canBeClick(); | ||
|
||
void keyBoardClick(); | ||
|
||
std::size_t getTempo(); | ||
std::size_t getTempoIndex() const; | ||
|
||
void setMusicSpeed(float speed) { m_MusicSpeed = speed; }; | ||
void setShowBeat(bool state) { isShowHeartBeat = state; }; | ||
void setRange(std::size_t range) { m_range = range; }; | ||
void setOffset(int16_t offset) { m_offset = offset; }; | ||
|
||
void setMusicCurrentTime(std::size_t time) { | ||
m_duringTime = time + m_offset; | ||
}; | ||
void Update(); | ||
|
||
std::vector<std::size_t> GetTempoTriggerList(); | ||
|
||
protected: | ||
void UpdateTime(); | ||
void UpdateTempoIndex(); | ||
|
||
private: | ||
std::vector<std::size_t> txtToVector( | ||
const std::string& line, | ||
const char splitChar | ||
); | ||
|
||
float m_MusicSpeed = 1.0f; | ||
|
||
bool isShowHeartBeat = false; | ||
bool m_isWrongTimeClick = false; | ||
std::size_t m_punishTimes = 0; | ||
|
||
std::size_t m_duringTime = 0; | ||
std::size_t m_range = 500; | ||
int16_t m_offset = 0; // (ms) | ||
|
||
std::size_t m_currentTempoTime = 0; | ||
std::size_t m_tempoIndex = 0; | ||
std::size_t m_currentTempoIndex = 0; | ||
std::size_t m_tempoListLength = 0; | ||
std::vector<std::size_t> m_tempoList; | ||
}; | ||
} // namespace Music | ||
|
||
#endif // FUCK_PTSD_TEMPO_H | ||
Oops, something went wrong.