// Copyright (C) 2002 -  2014 Rob Caelers & Raymond Penners
// All rights reserved.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
//

#ifndef SOUNDPLAYER_HH
#define SOUNDPLAYER_HH

#include "ISoundDriver.hh"

class IMixer;

class SoundPlayer
  : public workrave::audio::ISoundPlayer
  , public ISoundPlayerEvents
{
public:
  SoundPlayer();
  ~SoundPlayer() override;

  void init() override;
  bool capability(workrave::audio::SoundCapability cap) override;
  void restore_mute() override;
  void play_sound(const std::string &wavfile, bool mute_after_playback, int volume) override;

  std::vector<workrave::audio::SoundDevice> get_devices() override;
  void set_device(const std::string &device_id) override;
  std::string get_device() const override;
  boost::signals2::signal<void()> &signal_device_list_changed() override;

  void eos_event() override;
  void device_list_changed() override;

private:
  ISoundDriver *driver{nullptr};
  IMixer *mixer{nullptr};
  bool delayed_mute{false};
  bool must_unmute{false};
  boost::signals2::signal<void()> device_list_changed_signal;
};

#endif // SOUNDPLAYER_HH
