| 1 |
/* |
| 2 |
* Copyright (C) 2023 Linux Studio Plugins Project <https://lsp-plug.in/> |
| 3 |
* (C) 2023 Vladimir Sadovnikov <[email protected]> |
| 4 |
* |
| 5 |
* This file is part of lsp-plugins-clipper |
| 6 |
* Created on: 11 нояб. 2023 г. |
| 7 |
* |
| 8 |
* lsp-plugins-shared is free software: you can redistribute it and/or modify |
| 9 |
* it under the terms of the GNU Lesser General Public License as published by |
| 10 |
* the Free Software Foundation, either version 3 of the License, or |
| 11 |
* any later version. |
| 12 |
* |
| 13 |
* lsp-plugins-shared is distributed in the hope that it will be useful, |
| 14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
* GNU Lesser General Public License for more details. |
| 17 |
* |
| 18 |
* You should have received a copy of the GNU Lesser General Public License |
| 19 |
* along with lsp-plugins-shared. If not, see <https://www.gnu.org/licenses/>. |
| 20 |
*/ |
| 21 |
|
| 22 |
#ifndef LSP_PLUG_IN_SHARED_DEBUG_H_ |
| 23 |
#define LSP_PLUG_IN_SHARED_DEBUG_H_ |
| 24 |
|
| 25 |
#include <lsp-plug.in/common/debug.h> |
| 26 |
#include <lsp-plug.in/plug-fw/plug.h> |
| 27 |
|
| 28 |
namespace lsp |
| 29 |
{ |
| 30 |
/** |
| 31 |
* Trace port identifier and return the port passed as an argument |
| 32 |
* @param p port to trace |
| 33 |
* @return the poointer to the port passed as an argument |
| 34 |
*/ |
| 35 |
static inline plug::IPort *trace_port(plug::IPort *p) |
| 36 |
{ |
| 37 |
lsp_trace(" port id=%s", (p)->metadata()->id); |
| 38 |
return p; |
| 39 |
} |
| 40 |
|
| 41 |
#define NEXT_PORT() trace_port(ports[port_id++]) |
| 42 |
|
| 43 |
#ifdef LSP_TRACE |
| 44 |
#define BIND_PORT(dst) \ |
| 45 |
do { \ |
| 46 |
dst = ports[port_id++]; \ |
| 47 |
const ::lsp::meta::port_t *port_meta_ = dst->metadata(); \ |
| 48 |
lsp_trace("Bind port %s -> %s (%s)", port_meta_->id, LSP_STRINGIFY(dst), port_meta_->name); \ |
| 49 |
} while (false) |
| 50 |
|
| 51 |
#define SKIP_PORT(dst) \ |
| 52 |
do { \ |
| 53 |
const ::lsp::meta::port_t *port_meta_ = ports[port_id++]->metadata(); \ |
| 54 |
lsp_trace("Skip port %s -> %s (%s)", port_meta_->id, LSP_STRINGIFY(dst), port_meta_->name); \ |
| 55 |
} while (false) |
| 56 |
#else |
| 57 |
#define BIND_PORT(dst) \ |
| 58 |
do { dst = ports[port_id++]; } while (false) |
| 59 |
|
| 60 |
#define SKIP_PORT(dst) \ |
| 61 |
do { ++port_id; } while (false) |
| 62 |
#endif /* LSP_TRACE */ |
| 63 |
|
| 64 |
} /* namespace lsp */ |
| 65 |
|
| 66 |
#endif /* LSP_PLUG_IN_SHARED_DEBUG_H_ */ |