aboutsummaryrefslogtreecommitdiff
path: root/include/aomusicplayer.h
blob: 8e0d239a0dceaf7be32329d608673aef8e84061f (plain)
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
#ifndef AOMUSICPLAYER_H
#define AOMUSICPLAYER_H
#include "file_functions.h"

#if defined(BASSAUDIO)
#include "bass.h"
#elif defined(QTAUDIO)
#include <QMediaPlayer>
#endif
#include "aoapplication.h"

#include <QWidget>
#include <string.h>
#include <QDebug>

#if defined(BASSAUDIO)
class AOMusicPlayer
{
public:
  AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app);
  virtual ~AOMusicPlayer();
  void set_volume(int p_value, int channel=-1);
  void set_looping(bool toggle, int channel=0);

  const int m_channelmax = 4;

  //These have to be public for the stupid sync thing
//  QWORD loop_start = 0;
//  QWORD loop_end = 0;

public slots:
  void play(QString p_song, int channel=0, bool crossfade=false);
  void stop(int channel=0);

private:
  QWidget *m_parent;
  AOApplication *ao_app;

  bool m_looping = false;
  int m_volume = 0;

  // Channel 0 = music
  // Channel 1 = ambience
  // Channel 2 = extra
  // Channel 3 = extra
  HSTREAM m_stream_list[4];

//  HSYNC loop_sync;
};
#elif defined(QTAUDIO)
class AOMusicPlayer
{
public:
  AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app);
  ~AOMusicPlayer();

  void play(QString p_song);
  void set_volume(int p_value);

private:
  QMediaPlayer m_player;
  QWidget *m_parent;
  AOApplication *ao_app;

  int m_volume = 0;
};
#else
class AOMusicPlayer
{
public:
  AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app);
  ~AOMusicPlayer();

  void play(QString p_song);
  void set_volume(int p_value);

private:
  QWidget *m_parent;
  AOApplication *ao_app;
};
#endif

#endif // AOMUSICPLAYER_H