xtd - Reference Guide  0.1.2
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Loading...
Searching...
No Matches
beep.h
Go to the documentation of this file.
1
4#pragma once
5#include "console.h"
6#include "object.h"
7
9namespace xtd {
17 class beep final : public object {
18 public:
21 beep() = default;
22
26 beep(uint32_t frequency, uint32_t duration) : frequency_(frequency), duration_(duration) {}
27
29 friend std::ostream& operator<<(std::ostream& os, const beep& b) {
30 if (console::is_out_redirected() && os.rdbuf() == console::out.rdbuf())
31 console::beep(b.frequency_, b.duration_);
32 return os;
33 }
35
36 private:
37 uint32_t frequency_ {800};
38 uint32_t duration_ {200};
39 };
40}
Represent beep output manipulator class.
Definition beep.h:17
beep()=default
Plays the sound of a beep through the console speaker.
beep(uint32_t frequency, uint32_t duration)
Plays the sound of a beep of a specified frequency and duration through the console speaker.
Definition beep.h:26
static std::ostream out
Gets the standard output stream. A std::basic_ostream<char_t> that represents the standard output str...
Definition console.h:39
static void beep()
Plays the sound of a beep through the console speaker.
static bool is_out_redirected()
Gets a value that indicates whether the output stream has been redirected from the standard output st...
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.h:26
Contains xtd::console class.
@ b
The B key.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition system_report.h:17
Contains xtd::object class.