removed deactivation time from sounds

This commit is contained in:
Jonas Zeunert
2020-01-09 21:24:25 +01:00
parent 3871b298b1
commit 5f60719197
2 changed files with 4 additions and 10 deletions

View File

@@ -20,10 +20,10 @@ namespace items
namespace detail
{
Sound::Sound(std::shared_ptr<SoundBoardPinController> pin_controller, const uint8_t & address, const std::string & name, const std::chrono::milliseconds & deactivation_time, const u_int id)
: detail::Item(std::move(name)), DriverBoardItem(pin_controller, address), pin_controller(std::move(pin_controller)), deactivation_time(deactivation_time), id(id)
Sound::Sound(std::shared_ptr<SoundBoardPinController> pin_controller, const uint8_t & address, const std::string & name, const u_int id)
: detail::Item(std::move(name)), DriverBoardItem(pin_controller, address), pin_controller(std::move(pin_controller)), id(id)
{
CLOG(DEBUG, OUTPUT_LOGGER) << "Created sound " << id << " \"" << name << "\" with address " << int(address) << ". Deactivation time is: " << deactivation_time.count();
CLOG(DEBUG, OUTPUT_LOGGER) << "Created sound " << id << " \"" << name << "\" with address " << int(address);
}
void Sound::play()
@@ -35,10 +35,6 @@ void Sound::play()
void Sound::playTask()
{
pin_controller->activate(*this);
std::this_thread::sleep_for(deactivation_time);
//pin_controller->deactivate(*this);
}
}

View File

@@ -35,14 +35,12 @@ public:
u_int id;
public:
Sound(std::shared_ptr<SoundBoardPinController> pin_controller, const uint8_t & address, const std::string & name, const std::chrono::milliseconds & deactivation_time, const u_int id);
Sound(std::shared_ptr<SoundBoardPinController> pin_controller, const uint8_t & address, const std::string & name, const u_int id);
~Sound() override = default;
void play() override;
private:
const std::chrono::milliseconds deactivation_time;
const std::shared_ptr<SoundBoardPinController> pin_controller;
std::future<void> play_task;