diff options
author | David Robillard <d@drobilla.net> | 2017-12-25 15:26:48 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2017-12-25 16:26:13 -0500 |
commit | 15b3b0e9f8823752f80c7e597a70749813e61c79 (patch) | |
tree | 3f324c6e2a455be8b929456dadbf06520889d435 /src/server | |
parent | d6a9571641bcb34acb3521feb08eea33195fd9ca (diff) | |
download | ingen-15b3b0e9f8823752f80c7e597a70749813e61c79.tar.gz ingen-15b3b0e9f8823752f80c7e597a70749813e61c79.tar.bz2 ingen-15b3b0e9f8823752f80c7e597a70749813e61c79.zip |
Always use braces
Diffstat (limited to 'src/server')
-rw-r--r-- | src/server/BlockFactory.cpp | 3 | ||||
-rw-r--r-- | src/server/BlockImpl.cpp | 18 | ||||
-rw-r--r-- | src/server/ControlBindings.cpp | 3 | ||||
-rw-r--r-- | src/server/GraphImpl.cpp | 3 | ||||
-rw-r--r-- | src/server/InputPort.cpp | 3 | ||||
-rw-r--r-- | src/server/JackDriver.cpp | 6 | ||||
-rw-r--r-- | src/server/LV2Block.cpp | 18 | ||||
-rw-r--r-- | src/server/LV2Plugin.cpp | 8 | ||||
-rw-r--r-- | src/server/PortImpl.cpp | 9 | ||||
-rw-r--r-- | src/server/events/Delta.cpp | 3 | ||||
-rw-r--r-- | src/server/events/DisconnectAll.cpp | 3 | ||||
-rw-r--r-- | src/server/internals/Controller.cpp | 3 | ||||
-rw-r--r-- | src/server/internals/Note.cpp | 15 |
13 files changed, 63 insertions, 32 deletions
diff --git a/src/server/BlockFactory.cpp b/src/server/BlockFactory.cpp index 3314eb46..62912a21 100644 --- a/src/server/BlockFactory.cpp +++ b/src/server/BlockFactory.cpp @@ -48,8 +48,9 @@ BlockFactory::BlockFactory(Ingen::World* world) BlockFactory::~BlockFactory() { - for (auto& p : _plugins) + for (auto& p : _plugins) { delete p.second; + } _plugins.clear(); } diff --git a/src/server/BlockImpl.cpp b/src/server/BlockImpl.cpp index 36bf3e30..96ae0795 100644 --- a/src/server/BlockImpl.cpp +++ b/src/server/BlockImpl.cpp @@ -106,12 +106,15 @@ BlockImpl::prepare_poly(BufferFactory& bufs, uint32_t poly) { ThreadManager::assert_thread(THREAD_PRE_PROCESS); - if (!_polyphonic) + if (!_polyphonic) { poly = 1; + } - if (_ports) - for (uint32_t i = 0; i < _ports->size(); ++i) + if (_ports) { + for (uint32_t i = 0; i < _ports->size(); ++i) { _ports->at(i)->prepare_poly(bufs, poly); + } + } return true; } @@ -119,14 +122,17 @@ BlockImpl::prepare_poly(BufferFactory& bufs, uint32_t poly) bool BlockImpl::apply_poly(RunContext& context, uint32_t poly) { - if (!_polyphonic) + if (!_polyphonic) { poly = 1; + } _polyphony = poly; - if (_ports) - for (uint32_t i = 0; i < num_ports(); ++i) + if (_ports) { + for (uint32_t i = 0; i < num_ports(); ++i) { _ports->at(i)->apply_poly(context, poly); + } + } return true; } diff --git a/src/server/ControlBindings.cpp b/src/server/ControlBindings.cpp index 5f97452a..454d2be1 100644 --- a/src/server/ControlBindings.cpp +++ b/src/server/ControlBindings.cpp @@ -252,8 +252,9 @@ ControlBindings::port_value_to_control(RunContext& context, Type type, const Atom& value_atom) const { - if (value_atom.type() != port->bufs().forge().Float) + if (value_atom.type() != port->bufs().forge().Float) { return 0; + } float min, max; get_range(context, port, &min, &max); diff --git a/src/server/GraphImpl.cpp b/src/server/GraphImpl.cpp index 389fd182..bf1c99bf 100644 --- a/src/server/GraphImpl.cpp +++ b/src/server/GraphImpl.cpp @@ -221,8 +221,9 @@ GraphImpl::pre_process(RunContext& context) void GraphImpl::process(RunContext& context) { - if (!_process) + if (!_process) { return; + } pre_process(context); run(context); diff --git a/src/server/InputPort.cpp b/src/server/InputPort.cpp index cfc43526..2baa8ff7 100644 --- a/src/server/InputPort.cpp +++ b/src/server/InputPort.cpp @@ -58,8 +58,9 @@ bool InputPort::apply_poly(RunContext& context, uint32_t poly) { bool ret = PortImpl::apply_poly(context, poly); - if (!ret) + if (!ret) { poly = 1; + } assert(_voices->size() >= poly); diff --git a/src/server/JackDriver.cpp b/src/server/JackDriver.cpp index 0255c422..a4ae8e7b 100644 --- a/src/server/JackDriver.cpp +++ b/src/server/JackDriver.cpp @@ -108,8 +108,9 @@ JackDriver::attach(const std::string& server_name, // Either server name not specified, or supplied server name does not exist // Connect to default server if (!_client) { - if ((_client = jack_client_open(client_name.c_str(), JackNullOption, nullptr))) + if ((_client = jack_client_open(client_name.c_str(), JackNullOption, nullptr))) { _engine.log().info("Connected to default Jack server\n"); + } } // Still failed @@ -150,9 +151,10 @@ JackDriver::activate() return false; } - if (!_client) + if (!_client) { attach(world->conf().option("jack-server").ptr<char>(), world->conf().option("jack-name").ptr<char>(), nullptr); + } if (!_client) { return false; diff --git a/src/server/LV2Block.cpp b/src/server/LV2Block.cpp index 91490e69..05b76737 100644 --- a/src/server/LV2Block.cpp +++ b/src/server/LV2Block.cpp @@ -163,13 +163,15 @@ LV2Block::make_instance(URIs& uris, bool LV2Block::prepare_poly(BufferFactory& bufs, uint32_t poly) { - if (!_polyphonic) + if (!_polyphonic) { poly = 1; + } BlockImpl::prepare_poly(bufs, poly); - if (_polyphony == poly) + if (_polyphony == poly) { return true; + } const SampleRate rate = bufs.engine().sample_rate(); assert(!_prepared_instances); @@ -195,8 +197,9 @@ LV2Block::prepare_poly(BufferFactory& bufs, uint32_t poly) bool LV2Block::apply_poly(RunContext& context, uint32_t poly) { - if (!_polyphonic) + if (!_polyphonic) { poly = 1; + } if (_prepared_instances) { _instances = std::move(_prepared_instances); @@ -528,8 +531,9 @@ LV2Block::activate(BufferFactory& bufs) { BlockImpl::activate(bufs); - for (uint32_t i = 0; i < _polyphony; ++i) + for (uint32_t i = 0; i < _polyphony; ++i) { lilv_instance_activate(instance(i)); + } } void @@ -537,8 +541,9 @@ LV2Block::deactivate() { BlockImpl::deactivate(); - for (uint32_t i = 0; i < _polyphony; ++i) + for (uint32_t i = 0; i < _polyphony; ++i) { lilv_instance_deactivate(instance(i)); + } } LV2_Worker_Status @@ -572,8 +577,9 @@ LV2Block::work(uint32_t size, const void* data) void LV2Block::run(RunContext& context) { - for (uint32_t i = 0; i < _polyphony; ++i) + for (uint32_t i = 0; i < _polyphony; ++i) { lilv_instance_run(instance(i), context.nframes()); + } } void diff --git a/src/server/LV2Plugin.cpp b/src/server/LV2Plugin.cpp index cd29c0b1..4a4fd674 100644 --- a/src/server/LV2Plugin.cpp +++ b/src/server/LV2Plugin.cpp @@ -69,17 +69,19 @@ const Raul::Symbol LV2Plugin::symbol() const { string working = uri(); - if (working.back() == '/') + if (working.back() == '/') { working = working.substr(0, working.length() - 1); + } while (working.length() > 0) { size_t last_slash = working.find_last_of("/"); const string symbol = working.substr(last_slash+1); if ( (symbol[0] >= 'a' && symbol[0] <= 'z') - || (symbol[0] >= 'A' && symbol[0] <= 'Z') ) + || (symbol[0] >= 'A' && symbol[0] <= 'Z') ) { return Raul::Symbol::symbolify(symbol); - else + } else { working = working.substr(0, last_slash); + } } return Raul::Symbol("lv2_symbol"); diff --git a/src/server/PortImpl.cpp b/src/server/PortImpl.cpp index a3abe825..e8486645 100644 --- a/src/server/PortImpl.cpp +++ b/src/server/PortImpl.cpp @@ -380,8 +380,9 @@ PortImpl::set_buffer_size(RunContext& context, BufferFactory& bufs, size_t size) { _buffer_size = size; - for (uint32_t v = 0; v < _poly; ++v) + for (uint32_t v = 0; v < _poly; ++v) { _voices->at(v).buffer->resize(size); + } connect_buffers(); } @@ -397,8 +398,9 @@ PortImpl::connect_buffers(SampleCount offset) void PortImpl::recycle_buffers() { - for (uint32_t v = 0; v < _poly; ++v) + for (uint32_t v = 0; v < _poly; ++v) { _voices->at(v).buffer = nullptr; + } } void @@ -548,8 +550,9 @@ PortImpl::pre_process(RunContext& context) clear_buffers(context); } - for (uint32_t v = 0; v < _poly; ++v) + for (uint32_t v = 0; v < _poly; ++v) { _voices->at(v).buffer->prepare_output_write(context); + } } void diff --git a/src/server/events/Delta.cpp b/src/server/events/Delta.cpp index e5ff8325..e120e610 100644 --- a/src/server/events/Delta.cpp +++ b/src/server/events/Delta.cpp @@ -102,8 +102,9 @@ Delta::Delta(Engine& engine, Delta::~Delta() { - for (auto& s : _set_events) + for (auto& s : _set_events) { delete s; + } delete _create_event; } diff --git a/src/server/events/DisconnectAll.cpp b/src/server/events/DisconnectAll.cpp index 6d018c81..11311d12 100644 --- a/src/server/events/DisconnectAll.cpp +++ b/src/server/events/DisconnectAll.cpp @@ -66,8 +66,9 @@ DisconnectAll::DisconnectAll(Engine& engine, DisconnectAll::~DisconnectAll() { - for (auto& i : _impls) + for (auto& i : _impls) { delete i; + } } bool diff --git a/src/server/internals/Controller.cpp b/src/server/internals/Controller.cpp index 0366cbf0..36c735ce 100644 --- a/src/server/internals/Controller.cpp +++ b/src/server/internals/Controller.cpp @@ -157,8 +157,9 @@ ControllerNode::control(RunContext& context, uint8_t control_num, uint8_t val, F if (log_port_val > 0.0f) { // haaaaack, stupid negatives and logarithms Sample log_offset = 0; - if (min_port_val < 0) + if (min_port_val < 0) { log_offset = fabs(min_port_val); + } const Sample min = log(min_port_val + 1 + log_offset); const Sample max = log(max_port_val + 1 + log_offset); scaled_value = expf(nval * (max - min) + min) - 1 - log_offset; diff --git a/src/server/internals/Note.cpp b/src/server/internals/Note.cpp index 9b157d54..dc282417 100644 --- a/src/server/internals/Note.cpp +++ b/src/server/internals/Note.cpp @@ -130,13 +130,15 @@ NoteNode::NoteNode(InternalPlugin* plugin, bool NoteNode::prepare_poly(BufferFactory& bufs, uint32_t poly) { - if (!_polyphonic) + if (!_polyphonic) { return true; + } BlockImpl::prepare_poly(bufs, poly); - if (_prepared_voices && poly <= _prepared_voices->size()) + if (_prepared_voices && poly <= _prepared_voices->size()) { return true; + } _prepared_voices = bufs.maid().make_managed<Voices>( poly, *_voices, Voice()); @@ -147,8 +149,9 @@ NoteNode::prepare_poly(BufferFactory& bufs, uint32_t poly) bool NoteNode::apply_poly(RunContext& context, uint32_t poly) { - if (!BlockImpl::apply_poly(context, poly)) + if (!BlockImpl::apply_poly(context, poly)) { return false; + } if (_prepared_voices) { assert(_polyphony <= _prepared_voices->size()); @@ -383,9 +386,11 @@ NoteNode::sustain_off(RunContext& context, FrameTime time) _sustain = false; - for (uint32_t i=0; i < _polyphony; ++i) - if ((*_voices)[i].state == Voice::State::HOLDING) + for (uint32_t i=0; i < _polyphony; ++i) { + if ((*_voices)[i].state == Voice::State::HOLDING) { free_voice(context, i, time); + } + } } void |