20 current_buffer_size(0),
27 const size_t current_buffer_size,
28 const size_t max_buffer_size) :
31 current_buffer_size(current_buffer_size),
32 max_buffer_size(max_buffer_size)
39 if (!read_enabled(reader)) {
42 if (!read_current_buffer_size(reader)) {
45 if (!read_max_buffer_size(reader)) {
64 if (!write_enabled(writer)) {
67 if (!write_current_buffer_size(writer)) {
70 if (!write_max_buffer_size(writer)) {
110 yarp().setOwner(*
this);
136 return obj !=
nullptr;
155 if (group == 0 && is_dirty) {
164 mark_dirty_enabled();
190 will_set_current_buffer_size();
192 mark_dirty_current_buffer_size();
194 did_set_current_buffer_size();
200 return obj->current_buffer_size;
218 will_set_max_buffer_size();
220 mark_dirty_max_buffer_size();
222 did_set_max_buffer_size();
228 return obj->max_buffer_size;
269 writer.
writeString(
"send: 'help' or 'patch (param1 val1) (param2 val2)'");
284 if (!writer.
writeTag(
"many", 1, 0)) {
292 if (field ==
"enabled") {
299 if (!writer.
writeString(
"true if the playback is currently enabled")) {
303 if (field ==
"current_buffer_size") {
307 if (!writer.
writeString(
"size_t current_buffer_size")) {
310 if (!writer.
writeString(
"the size of the audio buffer [samples]")) {
314 if (field ==
"max_buffer_size") {
318 if (!writer.
writeString(
"size_t max_buffer_size")) {
321 if (!writer.
writeString(
"the max_size of the audio buffer [samples]")) {
336 bool have_act =
false;
337 if (tag !=
"patch") {
338 if (((len - 1) % 2) != 0) {
341 len = 1 + ((len - 1) / 2);
345 for (
int i = 1; i < len; ++i) {
359 if (key ==
"enabled") {
361 if (!obj->nested_read_enabled(reader)) {
365 }
else if (key ==
"current_buffer_size") {
366 will_set_current_buffer_size();
367 if (!obj->nested_read_current_buffer_size(reader)) {
370 did_set_current_buffer_size();
371 }
else if (key ==
"max_buffer_size") {
372 will_set_max_buffer_size();
373 if (!obj->nested_read_max_buffer_size(reader)) {
376 did_set_max_buffer_size();
404 if (is_dirty_enabled) {
414 if (!obj->nested_write_enabled(writer)) {
418 if (is_dirty_current_buffer_size) {
428 if (!obj->nested_write_current_buffer_size(writer)) {
432 if (is_dirty_max_buffer_size) {
442 if (!obj->nested_write_max_buffer_size(writer)) {
450 void AudioPlayerStatus::Editor::communicate()
455 if (
yarp().canWrite()) {
462 void AudioPlayerStatus::Editor::mark_dirty()
468 void AudioPlayerStatus::Editor::mark_dirty_enabled()
470 if (is_dirty_enabled) {
474 is_dirty_enabled =
true;
479 void AudioPlayerStatus::Editor::mark_dirty_current_buffer_size()
481 if (is_dirty_current_buffer_size) {
485 is_dirty_current_buffer_size =
true;
490 void AudioPlayerStatus::Editor::mark_dirty_max_buffer_size()
492 if (is_dirty_max_buffer_size) {
496 is_dirty_max_buffer_size =
true;
501 void AudioPlayerStatus::Editor::dirty_flags(
bool flag)
504 is_dirty_enabled = flag;
505 is_dirty_current_buffer_size = flag;
506 is_dirty_max_buffer_size = flag;
507 dirty_count = flag ? 3 : 0;
virtual bool did_set_current_buffer_size()
bool edit(AudioPlayerStatus &obj, bool dirty=true)
size_t get_max_buffer_size() const
AudioPlayerStatus & state()
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
size_t get_current_buffer_size() const
virtual bool did_set_enabled()
void set_enabled(const bool enabled)
virtual bool will_set_current_buffer_size()
virtual bool will_set_max_buffer_size()
virtual bool did_set_max_buffer_size()
virtual bool will_set_enabled()
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
void set_max_buffer_size(const size_t max_buffer_size)
void set_current_buffer_size(const size_t current_buffer_size)
AudioPlayerStatus: A class used to describe the status of an audio player device.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
std::string toString() const
size_t current_buffer_size
the size of the audio buffer [samples]
size_t max_buffer_size
the max_size of the audio buffer [samples]
bool enabled
true if the playback is currently enabled
bool write(const yarp::os::idl::WireWriter &writer) const override
bool read(yarp::os::idl::WireReader &reader) override
A simple collection of objects that can be described and transmitted in a portable way.
bool read(ConnectionReader &reader) override
Set the bottle's value based on input from a network connection.
std::string toString() const override
Gives a human-readable textual representation of the bottle.
An interface for reading from a network connection.
An interface for writing to a network connection.
bool setOwner(yarp::os::PortReader &owner)
Set the owner of this WireLink.
yarp::os::WireLink & yarp()
Get YARP state associated with this object.
IDL-friendly connection reader.
bool readString(std::string &str, bool *is_vocab=nullptr)
bool readSizeT(std::size_t &x)
IDL-friendly connection writer.
bool writeVocab32(yarp::conf::vocab32_t x) const
bool writeBool(bool x) const
bool writeListHeader(int len) const
bool writeTag(const char *tag, int split, int len) const
bool writeString(const std::string &tag) const
bool writeSizeT(std::size_t x) const
bool isValid()
Check if time is valid (non-zero).
The main, catch-all namespace for YARP.