1 #ifndef TRACK_HPP_INCLUDED
2 #define TRACK_HPP_INCLUDED
6 #include "Utilities.hpp"
10 #pragma GCC diagnostic push
11 #pragma GCC diagnostic ignored "-Wignored-qualifiers"
12 #include "Fmod/fmod.h"
13 #pragma GCC diagnostic pop
16 struct FMODSystemWrapper;
28 Track(
const std::string& filename);
76 void setSound(
const std::string& filename);
81 operator bool ()
const;
142 bool isFinished()
const;
143 bool isPaused()
const;
145 std::shared_ptr<FMODSystemWrapper> system;
147 FMOD_CHANNEL *channel;
148 FMOD_SYSTEM*getSystem();
174 void setGlobalVolume(
float vol);
175 void setChordVolume(
float vol);
176 void setMelodyVolume(
float vol);
178 float getGlobalVolume()
const;
179 float getChordVolume()
const;
180 float getMelodyVolume()
const;
190 bool isChordMute()
const;
191 bool isMelodyMute()
const;
193 void setBPM(
unsigned BPM);
194 unsigned getBPM()
const;
196 void setPosition(
const Time& p);
197 Time getPosition()
const;
198 Time getDuration()
const;
200 void setRepeat(
bool r);
201 bool getRepeat()
const;
203 operator bool()
const;
204 bool isFinished()
const;
207 static unsigned unique;
211 unsigned originalBPM;
216 #endif // TRACK_HPP_INCLUDED
void setRepeat(bool repeat)
Set the repeat option independently of the validity of the track.
Time getPosition() const
Returns the position in the Track (taking the speed into account) if the Track is valid...
Definition: Track.hpp:161
void setVolume(float vol)
Sets the Volume of the sound (or sets the volume for future use). This function does not unmute if it...
bool isMute() const
return whether the sound is muted (independently of its validity)
void pause()
If the Track is valid, pauses the sound.
This file defines all the data structures related to music objects.
float getSpeed() const
returns the speed
Describes a melody.
Definition: Music.hpp:629
void play()
If the Track is valid, plays the sound.
bool getRepeat() const
Return the repeat state independently of the validity of the track.
void setSpeed(float s)
Sets the speed. A speed of 2 corresponds to twice the normal speed.
void setSound(const std::string &filename)
Sets the Track to a new Sound The speed is reset to the speed of the new Sound, the volume...
void mute()
Mutes the sound.
Track()
Creates an invalid Track The volume is at max, repeat is set to false, speed i set to 1 and mute is s...
std::vector< Chord > ChordProgression
ChordProgression is the class used to give the set of chords used.
Definition: Music.hpp:592
~Track()
The Music stops when the object is destroyed.
float getVolume() const
Returns the volume of the sound independently of its validity The value does not depend on the "mute"...
void unmute()
Unmutes the Sound.
Time getDuration() const
If the track is valid, returns the duration of the sound at the current speed, otherwise, returns 0.
Definition: Utilities.hpp:14
void close()
Closes the sound (The Track becomes invalid)
void setPosition(const Time &t)
If the track is valid, sets the position in the track, otherwise it does nothing. ...