Avionics
Dropship Simulator
BASS.h
Go to the documentation of this file.
1 #pragma once
2 
3 // have to include these in this order because bass.h refers to something that screws it up
4 #include <WinSock2.h>
5 //#include <Windows.h>
6 //#include <WS2tcpip.h>
7 #include "../bass-2.4/c/bass.h"
8 
9 #include "Bus.h"
10 
11 namespace Devices
12 {
13  struct BassConfig
14  {
17  float initialVolume = 1.0f;
18 
19  struct Sound
20  {
21  std::string trigger;
22  std::string path;
23 
24  HSAMPLE sample = 0;
25  HCHANNEL channel = 0;
26 
27  bool loop = false;
28  bool mono = false;
29  bool restart = true; // interrupts play when played again
30  float pan = 0.0f; // -1 is full left, 1 is full right
31  float baseHz = 0.0f;
32  };
33 
34  std::vector<Sound> sounds;
35  };
36 
37  class Bass
38  {
39  private:
40  Logger* logger = nullptr;
41  BassConfig* config = nullptr;
42  Bus* bus = nullptr;
43 
44  HCHANNEL lastPlaying = NULL;
45  void EnumerateDevices() const;
46 
47  public:
48  void Initialize(Logger* prmLogger, BassConfig* prmConfig, Bus* prmBus);
49  void FrameMove();
50  void Destroy() const;
51  void Play(std::string trigger, float freq = -1.0f, float vol = 1.0f);
52  bool IsPlaying() const;
53  void StopAll() const;
54 
55  HSTREAM PlayStream(std::string filename) const;
56  bool StreamIsPlaying(HSTREAM streamHandle) const;
57  };
58 }
Logger * logger
Definition: BASS.h:40
Definition: Logger.h:5
void FrameMove()
Definition: BASS.cpp:69
std::string trigger
Definition: BASS.h:21
okay, the portable keyboard numbers don&#39;t work like the outside keypad because the outside keypad is ...
Definition: Analog.cpp:3
std::string path
Definition: BASS.h:22
std::vector< Sound > sounds
Definition: BASS.h:34
Definition: Bus.h:12
BassConfig * config
Definition: BASS.h:41
HCHANNEL lastPlaying
Definition: BASS.h:44
float initialVolume
Definition: BASS.h:17
HSTREAM PlayStream(std::string filename) const
Definition: BASS.cpp:226
void Play(std::string trigger, float freq=-1.0f, float vol=1.0f)
Definition: BASS.cpp:126
void Initialize(Logger *prmLogger, BassConfig *prmConfig, Bus *prmBus)
Definition: BASS.cpp:19
bool StreamIsPlaying(HSTREAM streamHandle) const
Definition: BASS.cpp:247
int soundDevice
The device to use... -1 = default device, 0 = no sound, 1 = first real output device. BASS_GetDeviceInfo can be used to enumerate the available devices.
Definition: BASS.h:16
Bus * bus
Definition: BASS.h:42
bool IsPlaying() const
Definition: BASS.cpp:213
void EnumerateDevices() const
Definition: BASS.cpp:5
void StopAll() const
Definition: BASS.cpp:218
void Destroy() const
Definition: BASS.cpp:110