My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes  
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
#ifndef AUDIOCONTROLLER_H
#define AUDIOCONTROLLER_H

#include "WavPlayer.h"
#include "MP3Player.h"

//**********************************************************
/**
* Wrap all calls to sounds and music
*/

class AudioController
{

int thread_id;

/// Is the app done
bool done;

/// If controller is paused or not
/// (use for thread management too)
bool paused;

private:
/// Player for sound effects
WavPlayer wav_player;

public:
/// Player for music
MP3Player mp3_player;

public:
AudioController();
void init();
void update();
void playMP3Section();
void setPause(bool p);
void addSample(WavSample* s);
void shutdownWavPlayer();
void initWavPlayer();
bool getPause(){ return paused; }

/// @return current song index in playlist
unsigned int getMusicIndex() { return mp3_player.getMusicIndex(); }


/// Reset the currently playing song index so, that
/// when a new multiplayer game begins, the song will restart
void resetSongIndex() { mp3_player.resetSongIndex(); }

void setRandomMusic();
bool isBusy();
void setMusic(std::string song);
void setMusic(unsigned int index);
void setMusicNoRestart(std::string song);

};


#endif /* AUDIOCONTROLLER_H */

Change log

r323 by kyle2 on May 19, 2011   Diff
Corner case found:
- Song will not restart on client, if same
song is chosen for next game by
  server (still playing current song,
etc).
- Forced song current index that MP3Player
has, to be UNKNOWN (just like at
  construction), so that the song will
restart

Go to: 
Project members, sign in to write a code review

Older revisions

r292 by kyle2 on May 17, 2011   Diff
Changing how multiplayer song sink is
happening

r289 by kyle2 on May 17, 2011   Diff
CLients now play what ever music the
server is playing

r243 by kyle2 on May 1, 2011   Diff
Multi

All revisions of this file

File info

Size: 1229 bytes, 60 lines

File properties

svn:eol-style
native
Powered by Google Project Hosting