This repository has been archived by the owner on May 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AudioLoop.h
113 lines (95 loc) · 2.93 KB
/
AudioLoop.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#include "fmod.hpp"
/*
// AudioLoop Class
// Building a wrapper class for Far Cry to CrossFade with control to the programmer
// Built by: Eelco Los
// Last Update: 18-01-2007
*/
#pragma once
#include "fmod.hpp"
#include "fmod_errors.h"
#include "errfunc.h"
#define WIN32_LEAN_AND_MEAN
#include "windows.h"
#include <vector>
#include "Singleton.h"
#include <iostream>
class AudioLoop
{
private:
//Channel properties
// FMOD::Channel *channel;
// FMOD::System *sys;
int channelid;
bool channelpaused;
//float channelvolume;
int channelcrossfadetime;
//Sound properties
// FMOD::Sound *sound;
char filename[255];
static int maxnumberofrepeats;
int numberoftimesplayed;
bool recentlyplayed;
std::vector<int> breakpoints;
FMOD_RESULT result;
bool beentroughCrossFadeOnce;
bool beentroughCurrentUpdate;
//bool beentroughLoadSound;
//bool soundloaded;
//bool soundavailable; // Checking if there is a sound in this AudioLoop
//bool channelavailable; // Checking if there is a channel in this AudioLoop
unsigned int percentageloaded;
int delaytime;
bool currentlyplaying;
//unsigned int breakpoint;
protected:
public:
//constuctor & destructors
AudioLoop();
~AudioLoop();
AudioLoop(char *filename, int maxnumberofrepeats, int crossfadetime, std::vector<int> breakpoints, FMOD::System *system);
void init();
FMOD::Sound* LoadSound(FMOD::System *sys);
//inits etc
void setdata(char *filename, int maxnumberofrepeats, int crossfadetime, std::vector<int> breakpoints,FMOD::System *system);
//functions
int getCurrentLocationReference();
int updatePosition(AudioLoop *otherfile, unsigned int breakpoint);
bool Crossfade(AudioLoop *otherfile);
void Play(AudioLoop *currentlyPlaying);
void Stop();
//retrieve functions
FMOD::Channel* getChannel();
FMOD::Sound* getSound();
char* getFileName();
bool getPausedChannel();
bool getbeentroughCrossFadeOnce();
bool getbeentroughCurrentUpdate();
float getChannelVolume();
bool getSoundLoaded();
int getPercentageLoaded();
int getNumberoftimesplayed();
int getNumbermaxtimeplay();
bool getRecentlyPlayed();
int getDelayTime();
int getChannelsPlaying();
bool getCurrentlyPlaying();
int getSoundLength();
int getCurrentPosition();
void setbeentroughCrossFadeOnce(bool truefalse);
void setbeentroughCurrentUpdate(bool truefalse);
void setChannelPaused(bool truefalse);
void setChannelVolume(float newvolume);
void setChannel(FMOD::Channel* newchan);
void addNumberoftimeplayed();
void addNumberoftimeplayed(int addition);
void setRecentlyPlayed(bool truefalse);
void setDelaytime(int newdelaytime);
int _SETTEST; // WARNING: SHOULD NOT BE USED BY ANYONE EXEPT THE (ORIGINAL) DEVELOPER
private:
// Channel properties
FMOD::Channel *channel;
FMOD::System *sys;
// Sound properties
FMOD::Sound *sound;
};