Sound.h
Sound.h
CPP1/* Copyright Statement:2 *3 * (C) 2021-2025 Cubios Inc. All rights reserved.4 */56#ifndef WASMLIBS_CPP_SOUND_H_7#define WASMLIBS_CPP_SOUND_H_89#include <string>10#include <vector>11#include "native.h"12#include "Object.h"1314namespace Cubios15{16class Sound: public Object17{18 public:19 explicit Sound(const std::string& name);20 ~Sound();21 void Play(uint8_t volume = 100);2223 static void Stop();24 static bool IsPlaying();2526 private:27 soundID_t id;28};2930class SoundCollection31{32 public:33 SoundCollection(std::vector<std::string>& names);34 SoundCollection(std::vector<Cubios::Sound*>& sounds);3536 virtual ~SoundCollection();3738 bool PlayRandomSound(uint8_t volume = 100, bool stopCurrent = true);39 bool RepeatRandomSounds(uint8_t volume, int delayMin, int delayMax, int deltaTime);4041 void Stop();42 bool IsPlaying();4344 private:45 std::vector<Cubios::Sound*> sounds;46 size_t numSounds;47 bool external;48 int16_t delay;49 Cubios::Sound* currentSound;50};5152}53#endif // WASMLIBS_CPP_SOUND_H_54
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.