optimizations, fix -O3 build, remove weird optimization flags
This commit is contained in:
parent
c55f7b820e
commit
047a5465cf
|
@ -210,7 +210,7 @@ then build and run the program normally. The program
|
|||
must end gracefully (ie, not Ctrl-C). When the
|
||||
program ends, run
|
||||
|
||||
gprof build/src/zrythm > results
|
||||
gprof --flat-profile --annotated-source -B --exec-counts --directory-path="$pwd)" --print-path --graph --table-length=16 --function-ordering --min-count=100 build/src/zrythm > results
|
||||
|
||||
and check the results file for the profiling results.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// SPDX-FileCopyrightText: © 2018-2022 Alexandros Theodotou <alex@zrythm.org>
|
||||
// SPDX-FileCopyrightText: © 2018-2023 Alexandros Theodotou <alex@zrythm.org>
|
||||
// SPDX-License-Identifier: LicenseRef-ZrythmLicense
|
||||
|
||||
/**
|
||||
|
@ -847,8 +847,14 @@ port_set_expose_to_backend (Port * self, int expose);
|
|||
/**
|
||||
* Returns if the port is exposed to the backend.
|
||||
*/
|
||||
NONNULL PURE int
|
||||
port_is_exposed_to_backend (const Port * self);
|
||||
NONNULL PURE static inline bool
|
||||
port_is_exposed_to_backend (const Port * self)
|
||||
{
|
||||
return self->internal_type == INTERNAL_JACK_PORT
|
||||
|| self->internal_type == INTERNAL_ALSA_SEQ_PORT
|
||||
|| self->id.owner_type == PORT_OWNER_TYPE_AUDIO_ENGINE
|
||||
|| self->exposed_to_backend;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renames the port on the backend side.
|
||||
|
@ -1033,32 +1039,29 @@ port_copy_values (Port * self, const Port * other);
|
|||
NONNULL void
|
||||
port_restore_from_non_project (Port * self, Port * non_project);
|
||||
|
||||
/**
|
||||
* Clears the audio/cv port buffer.
|
||||
*
|
||||
* @note Only the Zrythm buffer is cleared. Use
|
||||
* port_clear_external_buffer() to clear backend buffers.
|
||||
*/
|
||||
HOT NONNULL OPTIMIZE_O3 void
|
||||
port_clear_audio_cv_buffer (Port * port);
|
||||
|
||||
/**
|
||||
* Clears the MIDI port buffer.
|
||||
*
|
||||
* @note Only the Zrythm buffer is cleared. Use
|
||||
* port_clear_external_buffer() to clear backend buffers.
|
||||
*/
|
||||
HOT NONNULL OPTIMIZE_O3 void
|
||||
port_clear_midi_buffer (Port * port);
|
||||
|
||||
/**
|
||||
* Clears the port buffer.
|
||||
*
|
||||
* @note Only the Zrythm buffer is cleared. Use
|
||||
* port_clear_external_buffer() to clear backend buffers.
|
||||
*/
|
||||
HOT NONNULL OPTIMIZE_O3 void
|
||||
port_clear_buffer (Port * port);
|
||||
#define port_clear_buffer(_port) \
|
||||
{ \
|
||||
if (_port->id.type == TYPE_AUDIO || _port->id.type == TYPE_CV) \
|
||||
{ \
|
||||
if (_port->buf) \
|
||||
{ \
|
||||
dsp_fill ( \
|
||||
_port->buf, DENORMAL_PREVENTION_VAL, \
|
||||
AUDIO_ENGINE->block_length); \
|
||||
} \
|
||||
} \
|
||||
else if (_port->id.type == TYPE_EVENT) \
|
||||
{ \
|
||||
if (_port->midi_events) \
|
||||
_port->midi_events->num_events = 0; \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the backend's port buffer.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// SPDX-FileCopyrightText: © 2019-2021 Alexandros Theodotou <alex@zrythm.org>
|
||||
// SPDX-FileCopyrightText: © 2019-2021, 2023 Alexandros Theodotou <alex@zrythm.org>
|
||||
// SPDX-License-Identifier: LicenseRef-ZrythmLicense
|
||||
|
||||
/**
|
||||
|
@ -149,7 +149,7 @@ supported_file_type_get_ext (ZFileType type);
|
|||
/**
|
||||
* Returns the file type of the given file path.
|
||||
*/
|
||||
ZFileType
|
||||
NONNULL ZFileType
|
||||
supported_file_get_type (const char * file);
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,21 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2021 Alexandros Theodotou <alex at zrythm dot org>
|
||||
*
|
||||
* This file is part of Zrythm
|
||||
*
|
||||
* Zrythm is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Zrythm 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Zrythm. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
// SPDX-FileCopyrightText: © 2020-2021 Alexandros Theodotou <alex@zrythm.org>
|
||||
// SPDX-License-Identifier: LicenseRef-ZrythmLicense
|
||||
|
||||
/**
|
||||
* \file
|
||||
|
@ -87,7 +71,7 @@ z_carla_discovery_create_au_descriptor_from_info (
|
|||
/**
|
||||
* Create a descriptor for the given AU plugin.
|
||||
*/
|
||||
PluginDescriptor *
|
||||
NONNULL PluginDescriptor *
|
||||
z_carla_discovery_create_au_descriptor_from_string (
|
||||
const char * all_plugins,
|
||||
int idx);
|
||||
|
|
|
@ -29,8 +29,25 @@
|
|||
/**
|
||||
* Fill the buffer with the given value.
|
||||
*/
|
||||
HOT NONNULL void
|
||||
dsp_fill (float * buf, float val, size_t size);
|
||||
NONNULL HOT static inline void
|
||||
dsp_fill (float * buf, float val, size_t size)
|
||||
{
|
||||
#ifdef HAVE_LSP_DSP
|
||||
if (ZRYTHM_USE_OPTIMIZED_DSP)
|
||||
{
|
||||
lsp_dsp_fill (buf, val, size);
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
for (size_t i = 0; i < size; i++)
|
||||
{
|
||||
buf[i] = val;
|
||||
}
|
||||
#ifdef HAVE_LSP_DSP
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Clamp the buffer to min/max.
|
||||
|
|
|
@ -189,7 +189,8 @@ math_get_fader_val_from_amp (sample_t amp)
|
|||
amp = 1.f + 1e-20f;
|
||||
}
|
||||
sample_t fader =
|
||||
powf (6.f * logf (amp) + fader_coefficient1, 8.f)
|
||||
powf (
|
||||
6.f * math_fast_log (amp) + fader_coefficient1, 8.f)
|
||||
/ fader_coefficient2;
|
||||
return (sample_t) fader;
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ string_is_equal_ignore_case (
|
|||
*
|
||||
* Example: "MIDI ZRegion #1" -> "MIDI_Region_1".
|
||||
*/
|
||||
char *
|
||||
NONNULL char *
|
||||
string_convert_to_filename (const char * str);
|
||||
|
||||
/**
|
||||
|
|
34
meson.build
34
meson.build
|
@ -559,9 +559,6 @@ if get_option ('profiling')
|
|||
endif
|
||||
endif
|
||||
|
||||
common_cflags = []
|
||||
extra_optimizations_cflags = []
|
||||
|
||||
if get_option ('native_build')
|
||||
test_cflags += [
|
||||
'-march=native',
|
||||
|
@ -569,32 +566,28 @@ if get_option ('native_build')
|
|||
]
|
||||
endif
|
||||
|
||||
common_cflags = []
|
||||
|
||||
extra_optimizations_cflags = [
|
||||
'-ffast-math',
|
||||
'-DPIC',
|
||||
'-freciprocal-math',
|
||||
'-fsingle-precision-constant',
|
||||
]
|
||||
|
||||
if host_machine.cpu() == 'x86_64'
|
||||
extra_optimizations_cflags += [
|
||||
'-ffast-math',
|
||||
'-fstrength-reduce',
|
||||
'-DPIC',
|
||||
'-fdata-sections',
|
||||
'-ffunction-sections',
|
||||
'-freciprocal-math',
|
||||
'-fsingle-precision-constant',
|
||||
'-msse',
|
||||
'-msse2',
|
||||
'-mfpmath=sse',
|
||||
#'-fvisibility=hidden',
|
||||
'-fno-math-errno',
|
||||
]
|
||||
endif
|
||||
|
||||
if get_option ('extra_debug_info') or get_option ('debug') or get_option ('buildtype').contains ('debug')
|
||||
extra_optimizations_cflags += [
|
||||
# -O1 turns this on, but it may break backtraces so
|
||||
# explicitly turn it off on builds supposed to be
|
||||
# debuggable
|
||||
'-fno-omit-frame-pointer',
|
||||
]
|
||||
else
|
||||
# note: this may break the backtrace
|
||||
extra_optimizations_cflags += [
|
||||
'-fomit-frame-pointer',
|
||||
]
|
||||
endif
|
||||
extra_optimizations_cflags = cc.get_supported_arguments (extra_optimizations_cflags)
|
||||
|
||||
|
@ -702,7 +695,8 @@ test_strict_cflags += [
|
|||
'-Werror=multistatement-macros',
|
||||
'-Werror=switch',
|
||||
'-Werror=overflow',
|
||||
'-Werror=array-bounds',
|
||||
# breaks pango subproject build
|
||||
#'-Werror=array-bounds',
|
||||
'-Werror=enum-compare',
|
||||
'-Werror=misleading-indentation',
|
||||
'-Werror=int-in-bool-context',
|
||||
|
|
|
@ -142,7 +142,7 @@ option (
|
|||
'extra_optimizations',
|
||||
type: 'boolean',
|
||||
value: true,
|
||||
description: 'Turn on target machine-specific optimizations.')
|
||||
description: 'Turn on target machine-specific optimizations and optimizations not included in -O2.')
|
||||
|
||||
option (
|
||||
'extra_extra_optimizations',
|
||||
|
|
|
@ -6,6 +6,7 @@ charset-normalizer==3.2.0
|
|||
click==8.1.6
|
||||
docutils==0.20.1
|
||||
furo==2023.7.26
|
||||
gprof2dot==2022.7.29
|
||||
idna==3.4
|
||||
imagesize==1.4.1
|
||||
Jinja2==3.1.2
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "project.h"
|
||||
#include "utils/arrays.h"
|
||||
#include "utils/dialogs.h"
|
||||
#include "utils/dsp.h"
|
||||
#include "utils/error.h"
|
||||
#include "utils/flags.h"
|
||||
#include "utils/math.h"
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "project.h"
|
||||
#include "settings/settings.h"
|
||||
#include "utils/arrays.h"
|
||||
#include "utils/dsp.h"
|
||||
#include "utils/flags.h"
|
||||
#include "utils/mem.h"
|
||||
#include "utils/objects.h"
|
||||
|
|
|
@ -19,6 +19,7 @@ midi_function_type_to_string_id (MidiFunctionType type)
|
|||
{
|
||||
const char * type_str = midi_function_type_to_string (type);
|
||||
char * ret = g_strdup (type_str);
|
||||
g_return_val_if_fail (ret, NULL);
|
||||
for (size_t i = 0; i < strlen (ret); i++)
|
||||
{
|
||||
ret[i] = g_ascii_tolower (ret[i]);
|
||||
|
|
|
@ -30,7 +30,8 @@ peak_fall_smooth_calculate_coeff (
|
|||
const float frequency,
|
||||
const float sample_rate)
|
||||
{
|
||||
self->coeff = expf (-2.f * M_PI * frequency / sample_rate);
|
||||
self->coeff =
|
||||
expf (-2.f * (float) M_PI * frequency / sample_rate);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -87,6 +87,7 @@ audio_pool_ensure_unique_clip_name (
|
|||
char * orig_path_in_pool =
|
||||
audio_clip_get_path_in_pool (clip, is_backup);
|
||||
char * new_name = g_strdup (orig_name_without_ext);
|
||||
g_return_if_fail (new_name);
|
||||
|
||||
bool changed = false;
|
||||
while (name_exists (self, new_name))
|
||||
|
|
|
@ -3347,18 +3347,6 @@ port_set_expose_to_backend (Port * self, int expose)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if the port is exposed to the backend.
|
||||
*/
|
||||
int
|
||||
port_is_exposed_to_backend (const Port * self)
|
||||
{
|
||||
return self->internal_type == INTERNAL_JACK_PORT
|
||||
|| self->internal_type == INTERNAL_ALSA_SEQ_PORT
|
||||
|| self->id.owner_type == PORT_OWNER_TYPE_AUDIO_ENGINE
|
||||
|| self->exposed_to_backend;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renames the port on the backend side.
|
||||
*/
|
||||
|
@ -3500,56 +3488,6 @@ port_print_full_designation (Port * const self)
|
|||
g_message ("%s", buf);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the audio/cv port buffer.
|
||||
*
|
||||
* @note Only the Zrythm buffer is cleared. Use
|
||||
* port_clear_external_buffer() to clear backend buffers.
|
||||
*/
|
||||
void
|
||||
port_clear_audio_cv_buffer (Port * port)
|
||||
{
|
||||
if (port->buf)
|
||||
{
|
||||
dsp_fill (
|
||||
port->buf, DENORMAL_PREVENTION_VAL,
|
||||
AUDIO_ENGINE->block_length);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the MIDI port buffer.
|
||||
*
|
||||
* @note Only the Zrythm buffer is cleared. Use
|
||||
* port_clear_external_buffer() to clear backend buffers.
|
||||
*/
|
||||
void
|
||||
port_clear_midi_buffer (Port * port)
|
||||
{
|
||||
if (port->midi_events)
|
||||
port->midi_events->num_events = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the port buffer.
|
||||
*
|
||||
* @note Only the Zrythm buffer is cleared. Use
|
||||
* port_clear_external_buffer() to clear backend buffers.
|
||||
*/
|
||||
void
|
||||
port_clear_buffer (Port * port)
|
||||
{
|
||||
PortIdentifier * pi = &port->id;
|
||||
if (pi->type == TYPE_AUDIO || pi->type == TYPE_CV)
|
||||
{
|
||||
port_clear_audio_cv_buffer (port);
|
||||
}
|
||||
else if (port->id.type == TYPE_EVENT)
|
||||
{
|
||||
port_clear_midi_buffer (port);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the backend's port buffer.
|
||||
*/
|
||||
|
|
|
@ -254,19 +254,18 @@ closest_snap_point (
|
|||
*
|
||||
* @return Whether a snap point was found or not.
|
||||
*/
|
||||
HOT static bool
|
||||
get_prev_snap_point (
|
||||
NONNULL_ARGS (1, 4, 5)
|
||||
HOT static bool get_prev_snap_point (
|
||||
const Position * pos,
|
||||
Track * track,
|
||||
ZRegion * region,
|
||||
const SnapGrid * sg,
|
||||
Position * prev_sp)
|
||||
{
|
||||
position_set_to_pos (prev_sp, pos);
|
||||
if (pos->frames < 0 || pos->ticks < 0)
|
||||
{
|
||||
/* negative not supported, set to same
|
||||
* position */
|
||||
position_set_to_pos (prev_sp, pos);
|
||||
/* negative not supported, set to same position */
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -343,19 +342,19 @@ get_prev_snap_point (
|
|||
*
|
||||
* @return Whether a snap point was found or not.
|
||||
*/
|
||||
HOT static bool
|
||||
get_next_snap_point (
|
||||
NONNULL_ARGS (1, 4, 5)
|
||||
HOT static bool get_next_snap_point (
|
||||
const Position * pos,
|
||||
Track * track,
|
||||
ZRegion * region,
|
||||
const SnapGrid * sg,
|
||||
Position * next_sp)
|
||||
{
|
||||
position_set_to_pos (next_sp, pos);
|
||||
if (pos->frames < 0 || pos->ticks < 0)
|
||||
{
|
||||
/* negative not supported, set to same
|
||||
* position */
|
||||
position_set_to_pos (next_sp, pos);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -518,7 +517,6 @@ position_snap (
|
|||
/* get previous snap point from start pos */
|
||||
g_return_if_fail (start_pos);
|
||||
Position prev_sp_from_start_pos;
|
||||
position_init (&prev_sp_from_start_pos);
|
||||
get_prev_snap_point (
|
||||
start_pos, track, region, sg, &prev_sp_from_start_pos);
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
SupportedFile *
|
||||
supported_file_new_from_path (const char * path)
|
||||
{
|
||||
g_return_val_if_fail (path, NULL);
|
||||
SupportedFile * self = object_new (SupportedFile);
|
||||
|
||||
g_debug ("creating new SupportedFile for %s", path);
|
||||
|
|
|
@ -1059,10 +1059,9 @@ tracklist_track_name_is_unique (
|
|||
bool
|
||||
tracklist_has_soloed (const Tracklist * self)
|
||||
{
|
||||
Track * track;
|
||||
for (int i = 0; i < self->num_tracks; i++)
|
||||
{
|
||||
track = self->tracks[i];
|
||||
Track * track = self->tracks[i];
|
||||
|
||||
if (track->channel && track_get_soloed (track))
|
||||
return true;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// SPDX-FileCopyrightText: © 2021 Alexandros Theodotou <alex@zrythm.org>
|
||||
// SPDX-FileCopyrightText: © 2021, 2023 Alexandros Theodotou <alex@zrythm.org>
|
||||
// SPDX-License-Identifier: LicenseRef-ZrythmLicense
|
||||
|
||||
#include "dsp/engine.h"
|
||||
|
@ -88,6 +88,7 @@ add_tracks_to_group_dialog_widget_get_track (
|
|||
gtk_check_button_get_active (GTK_CHECK_BUTTON (checkbox));
|
||||
track_name = g_strdup (
|
||||
gtk_editable_get_text (GTK_EDITABLE (group_entry)));
|
||||
g_return_val_if_fail (track_name, NULL);
|
||||
gtk_window_destroy (GTK_WINDOW (self));
|
||||
switch (result)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// SPDX-FileCopyrightText: © 2019-2022 Alexandros Theodotou <alex@zrythm.org>
|
||||
// SPDX-FileCopyrightText: © 2019-2023 Alexandros Theodotou <alex@zrythm.org>
|
||||
// SPDX-License-Identifier: LicenseRef-ZrythmLicense
|
||||
|
||||
#include "dsp/engine.h"
|
||||
|
@ -37,12 +37,6 @@ midi_activity_bar_snapshot (
|
|||
int width = gtk_widget_get_allocated_width (widget);
|
||||
int height = gtk_widget_get_allocated_height (widget);
|
||||
|
||||
GtkStyleContext * context =
|
||||
gtk_widget_get_style_context (widget);
|
||||
|
||||
gtk_snapshot_render_background (
|
||||
snapshot, context, 0, 0, width, height);
|
||||
|
||||
if (!PROJECT || !AUDIO_ENGINE)
|
||||
{
|
||||
return;
|
||||
|
|
|
@ -1,21 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2019-2022 Alexandros Theodotou <alex at zrythm dot org>
|
||||
*
|
||||
* This file is part of Zrythm
|
||||
*
|
||||
* Zrythm is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Zrythm 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
// SPDX-FileCopyrightText: © 2019-2022 Alexandros Theodotou <alex@zrythm.org>
|
||||
// SPDX-License-Identifier: LicenseRef-ZrythmLicense
|
||||
|
||||
#include "actions/arranger_selections.h"
|
||||
#include "dsp/midi_note.h"
|
||||
|
@ -109,6 +93,7 @@ midi_modifier_arranger_widget_select_vels_in_range (
|
|||
int num_velocities = 0;
|
||||
Velocity ** velocities = get_enclosed_velocities (
|
||||
self, offset_x, &num_velocities, true);
|
||||
g_return_if_fail (velocities);
|
||||
|
||||
arranger_selections_clear (
|
||||
(ArrangerSelections *) MA_SELECTIONS, F_NO_FREE,
|
||||
|
@ -175,6 +160,7 @@ midi_modifier_arranger_widget_ramp (
|
|||
int num_velocities = 0;
|
||||
Velocity ** velocities = get_enclosed_velocities (
|
||||
self, offset_x, &num_velocities, true);
|
||||
g_return_if_fail (velocities);
|
||||
|
||||
/* ramp */
|
||||
Velocity * vel;
|
||||
|
@ -217,6 +203,7 @@ midi_modifier_arranger_widget_ramp (
|
|||
num_velocities = 0;
|
||||
velocities = get_enclosed_velocities (
|
||||
self, offset_x, &num_velocities, false);
|
||||
g_return_if_fail (velocities);
|
||||
|
||||
/* reset their value */
|
||||
for (int i = 0; i < num_velocities; i++)
|
||||
|
|
|
@ -50,7 +50,7 @@ windowHanning (int i, int transformSize)
|
|||
{
|
||||
return (
|
||||
0.5f
|
||||
* (1.0f - cosf (2.0f * M_PI * (float) i / (float) (transformSize - 1))));
|
||||
* (1.0f - cosf (2.0f * (float) M_PI * (float) i / (float) (transformSize - 1))));
|
||||
}
|
||||
|
||||
static float
|
||||
|
@ -60,12 +60,15 @@ getPowerSpectrumdB (
|
|||
const int index,
|
||||
const int transformSize)
|
||||
{
|
||||
const float real = out[index].r * (2.0 / transformSize);
|
||||
const float complex = out[index].i * (2.0 / transformSize);
|
||||
const float real =
|
||||
(float) out[index].r * (2.f / transformSize);
|
||||
const float complex =
|
||||
(float) out[index].i * (2.f / transformSize);
|
||||
|
||||
const float powerSpectrum = real * real + complex * complex;
|
||||
float powerSpectrumdB =
|
||||
10.0f / logf (10.0f) * logf (powerSpectrum + 1e-9);
|
||||
10.0f / math_fast_log (10.0f)
|
||||
* math_fast_log (powerSpectrum + 1e-9f);
|
||||
|
||||
if (powerSpectrumdB <= threshold)
|
||||
{
|
||||
|
@ -77,7 +80,7 @@ getPowerSpectrumdB (
|
|||
}
|
||||
|
||||
// Normalize values
|
||||
powerSpectrumdB = 1.0 - powerSpectrumdB / -90.0;
|
||||
powerSpectrumdB = 1.f - powerSpectrumdB / -90.f;
|
||||
|
||||
if (powerSpectrumdB > 1)
|
||||
{
|
||||
|
@ -95,10 +98,10 @@ invLogScale (const float value, const float min, const float max)
|
|||
if (value > max)
|
||||
return max;
|
||||
|
||||
const float b = logf (max / min) / (max - min);
|
||||
const float b = math_fast_log (max / min) / (max - min);
|
||||
const float a = max / expf (max * b);
|
||||
|
||||
return logf (value / a) / b;
|
||||
return math_fast_log (value / a) / b;
|
||||
}
|
||||
|
||||
static float
|
||||
|
@ -123,7 +126,7 @@ lerp (float a, float b, float f)
|
|||
{
|
||||
f = CLAMP (f, 0.0f, 1.0f);
|
||||
|
||||
return a * (1.0 - f) + (b * f);
|
||||
return a * (1.f - f) + (b * f);
|
||||
}
|
||||
|
||||
static float
|
||||
|
@ -155,12 +158,6 @@ spectrum_analyzer_snapshot (
|
|||
int width = gtk_widget_get_allocated_width (widget);
|
||||
int height = gtk_widget_get_allocated_height (widget);
|
||||
|
||||
GtkStyleContext * context =
|
||||
gtk_widget_get_style_context (widget);
|
||||
|
||||
gtk_snapshot_render_background (
|
||||
snapshot, context, 0, 0, width, height);
|
||||
|
||||
size_t block_size = AUDIO_ENGINE->block_length;
|
||||
uint32_t block_size_in_bytes =
|
||||
sizeof (float) * (uint32_t) block_size;
|
||||
|
|
|
@ -1635,17 +1635,17 @@ plugin_prepare_process (Plugin * self)
|
|||
{
|
||||
Port * port =
|
||||
g_ptr_array_index (self->audio_in_ports, i);
|
||||
port_clear_audio_cv_buffer (port);
|
||||
port_clear_buffer (port);
|
||||
}
|
||||
for (size_t i = 0; i < self->cv_in_ports->len; i++)
|
||||
{
|
||||
Port * port = g_ptr_array_index (self->cv_in_ports, i);
|
||||
port_clear_audio_cv_buffer (port);
|
||||
port_clear_buffer (port);
|
||||
}
|
||||
for (size_t i = 0; i < self->midi_in_ports->len; i++)
|
||||
{
|
||||
Port * port = g_ptr_array_index (self->midi_in_ports, i);
|
||||
port_clear_midi_buffer (port);
|
||||
port_clear_buffer (port);
|
||||
}
|
||||
|
||||
for (int i = 0; i < self->num_out_ports; i++)
|
||||
|
|
|
@ -363,9 +363,9 @@ plugin_descriptor_is_same_plugin (
|
|||
const PluginDescriptor * b)
|
||||
{
|
||||
return a->arch == b->arch && a->protocol == b->protocol
|
||||
&& a->unique_id == b->unique_id && a->ghash == b->ghash
|
||||
&& string_is_equal (a->path, b->path)
|
||||
&& string_is_equal (a->uri, b->uri)
|
||||
&& a->unique_id == b->unique_id && a->ghash == b->ghash;
|
||||
&& string_is_equal (a->uri, b->uri);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -15,29 +15,6 @@
|
|||
# include <lsp-plug.in/dsp/dsp.h>
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Fill the buffer with the given value.
|
||||
*/
|
||||
void
|
||||
dsp_fill (float * buf, float val, size_t size)
|
||||
{
|
||||
#ifdef HAVE_LSP_DSP
|
||||
if (ZRYTHM_USE_OPTIMIZED_DSP)
|
||||
{
|
||||
lsp_dsp_fill (buf, val, size);
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
for (size_t i = 0; i < size; i++)
|
||||
{
|
||||
buf[i] = val;
|
||||
}
|
||||
#ifdef HAVE_LSP_DSP
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the minimum of the buffer.
|
||||
*/
|
||||
|
|
|
@ -88,7 +88,7 @@ io_get_dir (const char * filename)
|
|||
* @return True if the directory exists or was successfully
|
||||
* created, false if error was occurred and errno is set.
|
||||
*/
|
||||
NONNULL bool
|
||||
bool
|
||||
io_mkdir (const char * dir, GError ** error)
|
||||
{
|
||||
g_return_val_if_fail (
|
||||
|
|
|
@ -96,13 +96,14 @@ get_match (
|
|||
const char * prefix,
|
||||
const char * codeset)
|
||||
{
|
||||
GString * codeset_gstring;
|
||||
codeset_gstring = g_string_new (codeset);
|
||||
char * upper =
|
||||
GString * codeset_gstring = g_string_new (codeset);
|
||||
char * upper =
|
||||
g_string_free (g_string_ascii_up (codeset_gstring), 0);
|
||||
g_return_val_if_fail (upper, NULL);
|
||||
codeset_gstring = g_string_new (codeset);
|
||||
char * lower =
|
||||
g_string_free (g_string_ascii_down (codeset_gstring), 0);
|
||||
g_return_val_if_fail (lower, NULL);
|
||||
char * first_upper = g_strdup (lower);
|
||||
first_upper[0] = g_ascii_toupper (lower[0]);
|
||||
|
||||
|
|
|
@ -654,6 +654,7 @@ zrythm_init_user_dirs_and_files (Zrythm * self, GError ** error)
|
|||
|
||||
#define MK_USER_DIR(x) \
|
||||
dir = zrythm_get_dir (ZRYTHM_DIR_USER_##x); \
|
||||
g_return_val_if_fail (dir, false); \
|
||||
success = io_mkdir (dir, &err); \
|
||||
if (!success) \
|
||||
{ \
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[wrap-file]
|
||||
directory = pango-1.50.6
|
||||
directory = pango-1.51.0
|
||||
|
||||
source_url = https://download.gnome.org/sources/pango/1.50/pango-1.50.6.tar.xz
|
||||
source_filename = pango-1.50.6.tar.xz
|
||||
source_hash = a998bcf36881c3ac20495d40bceb304f4eaa9175bd2967c85656434cbdafe86a
|
||||
source_url = https://download.gnome.org/sources/pango/1.51/pango-1.51.0.tar.xz
|
||||
source_filename = pango-1.51.0.tar.xz
|
||||
source_hash = 74efc109ae6f903bbe6af77eaa2ac6094b8ee245a2e23f132a7a8f0862d1a9f5
|
||||
|
|
|
@ -219,6 +219,7 @@ _test_port_connection (
|
|||
object_free_w_func_and_null (g_ptr_array_unref, ports);
|
||||
|
||||
g_assert_nonnull (dest_port);
|
||||
g_return_if_fail (dest_port);
|
||||
g_assert_true (port_is_in_active_project (src_port1));
|
||||
g_assert_true (port_is_in_active_project (src_port2));
|
||||
g_assert_true (port_is_in_active_project (dest_port));
|
||||
|
|
|
@ -52,6 +52,7 @@ test_midi_fx_routing (void)
|
|||
/* export loop and check that there is audio */
|
||||
char * audio_file = test_exporter_export_audio (
|
||||
TIME_RANGE_LOOP, EXPORT_MODE_FULL);
|
||||
g_return_if_fail (audio_file);
|
||||
g_assert_false (audio_file_is_silent (audio_file));
|
||||
io_remove (audio_file);
|
||||
g_free (audio_file);
|
||||
|
@ -75,6 +76,7 @@ test_midi_fx_routing (void)
|
|||
/* export loop and check that there is no audio */
|
||||
audio_file = test_exporter_export_audio (
|
||||
TIME_RANGE_LOOP, EXPORT_MODE_FULL);
|
||||
g_return_if_fail (audio_file);
|
||||
g_assert_true (audio_file_is_silent (audio_file));
|
||||
io_remove (audio_file);
|
||||
g_free (audio_file);
|
||||
|
@ -89,6 +91,7 @@ test_midi_fx_routing (void)
|
|||
* again */
|
||||
audio_file = test_exporter_export_audio (
|
||||
TIME_RANGE_LOOP, EXPORT_MODE_FULL);
|
||||
g_return_if_fail (audio_file);
|
||||
g_assert_false (audio_file_is_silent (audio_file));
|
||||
io_remove (audio_file);
|
||||
g_free (audio_file);
|
||||
|
|
|
@ -32,9 +32,9 @@ if get_option ('tests')
|
|||
test_env.set ('ZRYTHM_DEBUG', '1')
|
||||
test_env.set ('Z_CURL_TIMEOUT', '10')
|
||||
test_env.set ('G_MESSAGES_DEBUG', 'zrythm')
|
||||
test_env.set ('ZRYTHM_DSP_THREADS', '3')
|
||||
test_env.set ('ZRYTHM_DSP_THREADS', '4')
|
||||
test_env.set ('PIPEWIRE_RUNTIME_DIR', '/tmp/zrythm-pipewire')
|
||||
test_env.set ('PIPEWIRE_DEBUG', 'D')
|
||||
test_env.set ('PIPEWIRE_DEBUG', '3')
|
||||
|
||||
test_config = configuration_data ()
|
||||
test_config.set_quoted (
|
||||
|
|
|
@ -158,7 +158,7 @@ test_new_from_template (void)
|
|||
|
||||
/* create a new project using old one as template */
|
||||
char * orig_dir = g_strdup (PROJECT->dir);
|
||||
g_assert_nonnull (orig_dir);
|
||||
g_return_if_fail (orig_dir);
|
||||
char * filepath =
|
||||
g_build_filename (orig_dir, "project.zpj", NULL);
|
||||
g_free_and_null (ZRYTHM->create_project_path);
|
||||
|
@ -199,7 +199,7 @@ test_save_as_load_w_pool (void)
|
|||
|
||||
/* save the project elsewhere */
|
||||
char * orig_dir = g_strdup (PROJECT->dir);
|
||||
g_assert_nonnull (orig_dir);
|
||||
g_return_if_fail (orig_dir);
|
||||
char * new_dir =
|
||||
g_dir_make_tmp ("zrythm_test_project_XXXXXX", NULL);
|
||||
bool success = project_save (
|
||||
|
@ -383,6 +383,8 @@ test_exposed_ports_after_load (void)
|
|||
|
||||
test_project_save_and_reload ();
|
||||
|
||||
track = TRACKLIST->tracks[TRACKLIST->num_tracks - 1];
|
||||
port = track->channel->stereo_out->l;
|
||||
g_assert_true (port_is_exposed_to_backend (port));
|
||||
assert_jack_port_exists (buf);
|
||||
|
||||
|
|
Loading…
Reference in New Issue