summary refs log tree commit diff stats
path: root/src/muxer.h
blob: 8c643de87833be5300b3d15fb4506de9acbe5028 (plain) (blame)
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
#ifndef MUXER_H_3146C802
#define MUXER_H_3146C802

#include <memory>
#include <string>
#include <fmod_studio_common.h>
#include <fmod_studio.hpp>

class fmod_system_deleter {
public:
  void operator()(FMOD::Studio::System* val) {
    val->release();
  }
};

using fmod_system_ptr = std::unique_ptr<FMOD::Studio::System, fmod_system_deleter>;

enum class TransitionState {
  Pre,
  Transition,
  Post,
  Stopped
};

class Muxer {
public:
  Muxer();

  void setPlayerLoc(int x, int y);

  void playSound(std::string name);

  void playSoundAtPosition(std::string name, float x, float y);

  void setMusicLevel(int level);

  void startMusic();

  void stopMusic();

  void update();

  void toggleMute();

private:
  fmod_system_ptr system_;
  FMOD::Studio::EventInstance* exploration_event_;
  FMOD::Studio::EventInstance* transition_event_;
  FMOD::Studio::EventInstance* the_world_event_;
  TransitionState transition_state_ = TransitionState::Pre;
  bool muted_ = false;
};

#endif /* end of include guard: MUXER_H_3146C802 */