-
Notifications
You must be signed in to change notification settings - Fork 0
/
sound.h
57 lines (44 loc) · 2.28 KB
/
sound.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef SOUND_PLAYBACK_H
#define SOUND_PLAYBACK_H
#include <string>
#include <gtk/gtk.h>
#include <tag.h>
#include <fileref.h>
#include <tyrsound.h>
#include "song.h"
//For changing audio file tags
#define CHANGE_TITLE 0
#define CHANGE_ARTIST 1
#define CHANGE_ALBUM 2
#define CHANGE_TRACK 3
typedef uint8_t tagType;
//Global functions
void init_sound(); //Initializes tyrsound
void cleanup_sound(); //Closes tyrsound
void load_song(std::string sFilename); //Loads a song from a filename
void play_song(); //Starts playing the last song loaded into memory
void pause_song(); //Pauses the currently playing music
void rewind_song(); //Rewinds the currently-playing song to the beginning
void setVolume(float fVol); //Set the current volume (between 0 and 1)
float getVolume(); //Get the current volume
void add_to_playlist(std::string sFilename); //Add this song to the current playlist
void add_to_playlist(song s);
void set_music_loc(float fPos); //Set the music to play from pos (0.0 to 1.0)
bool change_tag(std::string sFilename, tagType tagToChange, gchar *sNewTag); //Change the tag in a music file
float get_song_length(std::string sFilename); //Get requested song's length in seconds
float get_song_length(); //Return current song length in seconds
void loop_song(bool bLoop); //Sets whether we should loop this one song indefinitely or not
void stop_song(); //Stop playing the current song
bool song_is_valid(); //See if our current song handle is valid
bool is_playing(); //See if the song is playing or not
song song_get_tags(std::string sSongFilename);
void song_get_tags(std::string sSongFilename, std::string& sAlbum, std::string& sTitle, std::string& sArtist, unsigned int& iTrack, int& iLength);
//Callbacks (Don't call directly)
gboolean check_music_playing(gpointer data); //Callback for every loop to update and check song playback
//Supported file types
#define OGG_SUPPORT
#define OPUS_SUPPORT
#define FLAC_SUPPORT
//#define WAV_SUPPORT
#define MP3_SUPPORT
#endif