Skip to content

Commit 43c3d84

Browse files
authored
Merge pull request #50 from phandasm/develop
Merge develop branch for v1.7.0
2 parents 24f109d + 184ca50 commit 43c3d84

19 files changed

+771
-455
lines changed

CMakeLists.txt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
cmake_minimum_required(VERSION 3.16)
22

3-
set(CMAKE_CXX_STANDARD 17)
3+
set(CMAKE_CXX_STANDARD 20)
44
set(CMAKE_CXX_STANDARD_REQUIRED ON)
55
set(CMAKE_CXX_EXTENSIONS OFF)
66

77
include(CheckSymbolExists)
88

99
project(waveform)
1010

11-
set(WAVEFORM_VERSION "1.6.1")
11+
set(WAVEFORM_VERSION "1.7.0")
1212

1313
# set default install prefix to OBS plugin path on linux and MacOS
1414
# otherwise set it to the windows installer source folder
@@ -48,13 +48,13 @@ if(NOT TARGET OBS::libobs)
4848
find_package(LibObs REQUIRED)
4949

5050
# emulate modern target
51-
add_library(OBS::libobs INTERFACE IMPORTED GLOBAL)
51+
add_library(OBS::libobs INTERFACE IMPORTED)
5252
target_link_libraries(OBS::libobs INTERFACE ${LIBOBS_LIBRARIES})
5353
target_include_directories(OBS::libobs INTERFACE ${LIBOBS_INCLUDE_DIRS})
5454
endif()
5555

5656
if(MSVC)
57-
add_definitions(/MP) # parallel builds
57+
add_compile_options(/MP) # parallel builds
5858

5959
option(EXTRA_OPTIMIZATIONS "Enable additional compiler optimizations" OFF)
6060
if(EXTRA_OPTIMIZATIONS)
@@ -139,7 +139,7 @@ set(PLUGIN_SOURCES
139139
"src/source.hpp"
140140
"src/source.cpp"
141141
"src/source_generic.cpp"
142-
"src/membuf.hpp"
142+
"src/aligned_buffer.hpp"
143143
"src/math_funcs.hpp"
144144
"src/filter.hpp"
145145
"src/settings.hpp"
@@ -152,7 +152,6 @@ if(NOT DISABLE_X86_SIMD)
152152
"src/source_avx2.cpp"
153153
"src/source_avx.cpp"
154154
"src/filter_fma3.cpp"
155-
"src/aligned_mem.hpp"
156155
)
157156

158157
# arch flags
@@ -194,7 +193,6 @@ target_link_libraries(waveform PRIVATE OBS::libobs ${FFTW_LIBRARIES})
194193
if(NOT DISABLE_X86_SIMD)
195194
target_link_libraries(waveform PRIVATE cpu_features)
196195
endif()
197-
target_compile_definitions(waveform PRIVATE _USE_MATH_DEFINES)
198196
if(MSVC)
199197
target_compile_options(waveform PRIVATE "/W4") # warning level
200198
target_link_options(waveform PRIVATE "$<$<CONFIG:Release>:/OPT:REF>") # reduce size of release binaries

README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,18 @@ It is based on [FFTW](https://www.fftw.org/) and optimized for AVX2/FMA3.
99
Clone the repo with submodules: `git clone --recurse-submodules`
1010
Or if you already cloned without them: `git submodule update --init --recursive`
1111

12+
## Minimum Supported Compilers
13+
- GCC 10.1
14+
- Clang 11.0
15+
- VS 2019 16.8
16+
1217
## Windows
1318
Waveform's only external dependency is libobs.
1419
You'll need to build obs-studio separately and point [CMake](https://cmake.org/) to it when building Waveform.
1520
From the CLI interface, the latter can be accomplished via `-DCMAKE_PREFIX_PATH="path/to/obs-studio/build"`.
1621

17-
## Linux (Ubuntu 20.04.3 LTS)
22+
## Linux
23+
### Ubuntu 20.04
1824
```bash
1925
# install build tools
2026
sudo apt-get install build-essential git cmake
@@ -34,3 +40,18 @@ cmake ..
3440
make
3541
make install
3642
```
43+
44+
### Fedora
45+
**Prerequisite:** OBS packages from RPM Fusion (see [OBS Wiki](https://obsproject.com/wiki/unofficial-linux-builds#fedora)).
46+
47+
```bash
48+
sudo dnf install @development-tools cmake obs-studio-devel fftw-devel
49+
50+
git clone --recurse-submodules https://github.com/phandasm/waveform.git
51+
mkdir waveform/build
52+
cd waveform/build
53+
54+
cmake ..
55+
make
56+
make install
57+
```

THANKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ Romain <https://github.com/rmnvgr>
55
神枪968 <https://github.com/GodGun968>
66
Ori Sky <https://github.com/ori-sky>
77
Kai Lee <https://github.com/KaiLee2588>
8+
Peppe73

changelog.md

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,14 @@
1-
# Notice to Intel Mac users
2-
OBS requirement has been bumped to 28, please uninstall older versions of waveform first.
3-
4-
## Changes in 1.6.1
5-
- Fix MacOS x64 installer
6-
- Update Chinese localization (#43 thanks to GodGun968)
7-
8-
## Changes in 1.6.0
9-
- Add option to mirror frequency axis
10-
- Add option to adjust arc angle in radial mode
11-
- Add option for minimum bar height
12-
- Add option to adjust normalized volume target
13-
- Add "Single" channel mode to allow selection of specific audio channel
14-
- Fix some potential crashes
15-
- Fix graph frozen after playback of media file finishes
16-
- Fix "Hide graph when audio is silent" option for level meters
17-
- Update Chinese localization (#32, #38 thanks to GodGun968)
18-
- Improve rendering of curve graph in some cases
19-
- Performance improvements
1+
## Changes in 1.7.0-beta1
2+
- Add the ironically missing-until-now waveform display mode (experimental)
3+
- Add 'Pulse' render mode
4+
- Add option to continue processing audio while source is muted
5+
- Add option to adjust maximum volume normalization gain
6+
- Add option to adjust rotation of radial display
7+
- Add Traditional Chinese localization (#44 thanks to Kai Lee)
8+
- Add Italian localization (thanks to Peppe73)
9+
- Attempt to mitigate A/V desync in some setups
10+
- Fix spectrum accuracy, **spectrum graphs will appear slightly "louder" now.**
11+
- Increase 'FFT Size' limit
2012

2113
## Installation
2214
### Windows
@@ -33,7 +25,7 @@ or
3325
- Download Waveform\_v#.#.#\_Ubuntu\_x86\_64.deb and install it using your distro's package manager (Debian/Ubuntu only).
3426

3527
#### Flatpak
36-
- `flatpak install flathub com.obsproject.Studio.Plugins.waveform`
28+
- `flatpak install flathub com.obsproject.Studio.Plugin.waveform`
3729

3830
#### Source Build
3931
- Step-by-step instructions in the [readme](https://github.com/phandasm/waveform/blob/master/README.md#linux-ubuntu-20043-lts).

data/gradient.effect

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ uniform float graph_deadzone = 0.0;
1111
uniform bool graph_invert = false;
1212
uniform float2 radial_center = {0.0, 0.0};
1313
uniform float radial_arc = 1.0;
14+
uniform float radial_rotation = 0.0;
1415

1516
struct VertInOut {
1617
float4 pos : POSITION;
@@ -39,7 +40,7 @@ VertGrad VSGradient(VertInOut vert_in)
3940
VertGrad VSRadial(VertInOut vert_in)
4041
{
4142
VertGrad vert_out;
42-
float angle = saturate(vert_in.pos.x / graph_width) * radial_arc * 6.283185307179586f;
43+
float angle = (saturate(vert_in.pos.x / graph_width) * radial_arc * 6.283185307179586f) + radial_rotation;
4344
vert_out.pos = float4(vert_in.pos.xyz, 1.0);
4445
if(graph_invert)
4546
{

data/locale/en-US.ini

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,17 @@ ignore_mute="Process While Muted"
99

1010
normalize_volume="Normalize Volume"
1111
volume_target="Target Volume"
12+
max_gain="Maximum Gain"
1213

1314
render_mode="Render Mode"
1415
line="Line"
1516
solid="Solid"
1617
gradient="Gradient"
18+
pulse="Pulse"
19+
20+
pulse_mode="Pulse Mode"
21+
peak_magnitude="Peak Magnitude"
22+
peak_frequency="Peak Frequency"
1723

1824
width="Video Width"
1925
height="Video Height"
@@ -26,6 +32,7 @@ radial_layout="Radial Layout"
2632
invert_direction="Invert Radial Direction"
2733
deadzone="Deadzone"
2834
radial_arc="Radial Arc"
35+
radial_rotation="Radial Rotation"
2936

3037
rounded_caps="Rounded Caps"
3138

@@ -81,9 +88,10 @@ bars="Bars"
8188
stepped_bars="Stepped Bars"
8289
level_meter="Level Meter"
8390
stepped_level_meter="Stepped Level Meter"
91+
waveform="Waveform (experimental)"
8492

8593
rms_mode="RMS Mode"
86-
meter_buf="Meter Buffer"
94+
meter_buf="Buffer Size"
8795

8896
bar_width="Bar Width"
8997
bar_gap="Bar Gap"

data/locale/it-IT.ini

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
source_name="Waveform"
2+
3+
audio_source="Sorgente audio"
4+
none="Nessuno"
5+
output_bus="Bus di uscita"
6+
7+
hide_on_silent="Nascondi il grafico quando l'audio è silenzioso".
8+
9+
normalize_volume="Normalizza volume".
10+
11+
render_mode="Modalità di rendering".
12+
line="Linea"
13+
solid="Solido"
14+
gradient="Gradiente"
15+
16+
width="Larghezza spettro"
17+
height="Altezza spettro"
18+
19+
log_scale="Scala frequenza logaritmica"
20+
21+
radial_layout="Spettro rotondo".
22+
invert_direction="Inverti direzione radiale"
23+
deadzone="Zona morta"
24+
25+
rounded_caps="Tappi arrotondati".
26+
27+
window="Finestra"
28+
hann="Hann"
29+
hamming="Hamming"
30+
blackman="Blackman"
31+
blackman_harris="Blackman-Harris"
32+
33+
auto_fft_size="Dimensione FFT automatica"
34+
fft_size="Dimensione FFT".
35+
36+
channel_mode="Modalità canale"
37+
mono="Mono"
38+
stereo="Stereo"
39+
40+
channel_spacing="Spaziatura tra i canali".
41+
42+
interp_mode="Interpolazione"
43+
point="Molto vicini"
44+
lanczos="Lanczos"
45+
46+
filter_mode="Filtro"
47+
filter_radius="Raggio del filtro".
48+
gauss="Gaussiana"
49+
50+
cutoff_low="Taglio bassi"
51+
cutoff_high="Taglio alti"
52+
53+
floor="Onda bassa"
54+
ceiling="Onda alta"
55+
56+
slope="Pendenza"
57+
58+
rolloff_q="Larghezza di banda di roll-off (ottave)".
59+
rolloff_rate="Velocità di roll-off (dB/Ottava)".
60+
61+
gravity="Gravità"
62+
temporal_smoothing="Attenuazione temporale".
63+
exp_moving_avg="Media mobile esponenziale".
64+
fast_peaks="Picchi veloci".
65+
66+
color_base="Colore di base"
67+
color_crest="Colore della cresta".
68+
grad_ratio="Rapporto gradiente".
69+
70+
display_mode="Modalità di visualizzazione"
71+
curve="Curva"
72+
bars="Barre"
73+
stepped_bars="Barre a gradini".
74+
level_meter="Misuratore di livello"
75+
stepped_level_meter="Misuratore di livello a gradini".
76+
77+
rms_mode="Modo RMS"
78+
meter_buf="Buffer del misuratore"
79+
80+
bar_width="Larghezza barra"
81+
bar_gap="Intervallo barra"
82+
step_width="Larghezza passo"
83+
step_gap="Spazio tra i passi".
84+
85+
chan_desc="Grafico canali L/R separati o singolo canale sommato".
86+
auto_fft_desc="Calcola le dimensioni della FFT in base a FPS e frequenza di campionamento."
87+
fft_desc="Valori più grandi aumentano la risoluzione della frequenza, ma sono più intensivi per la CPU e aumentano la latenza."
88+
window_desc="Funzione finestra FFT".
89+
temporal_desc="Smussamento nel dominio del tempo dei bins di frequenza. Riduce il jitter".
90+
gravity_desc="Controlla la velocità di risposta del grafico ai nuovi input."
91+
fast_peaks_desc="I bins di frequenza rispondono istantaneamente agli aumenti di magnitudine (utile con la media mobile lenta)."
92+
interp_desc="Ricampionamento dei bins di frequenza."
93+
filter_desc="Smussamento geometrico".
94+
slope_desc="Aumenta le alte frequenze".
95+
deadzone_desc="Quantità di spazio da lasciare vuoto al centro di un layout radiale."
96+
caps_desc="Arrotonda la parte superiore e inferiore di ogni barra".
97+
rolloff_q_desc="Arrotonda i bordi del grafico a partire da N ottave dai punti di taglio."
98+
rolloff_rate_desc="Tasso di attenuazione ai bordi in decibel per ottava".
99+
volume_normalization_desc="Scala dinamicamente il grafico per compensare le variazioni di volume."

src/aligned_buffer.hpp

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
/*
2+
Copyright (C) 2023 Devin Davila
3+
4+
This program is free software: you can redistribute it and/or modify
5+
it under the terms of the GNU General Public License as published by
6+
the Free Software Foundation, either version 3 of the License, or
7+
(at your option) any later version.
8+
9+
This program is distributed in the hope that it will be useful,
10+
but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
GNU General Public License for more details.
13+
14+
You should have received a copy of the GNU General Public License
15+
along with this program. If not, see <https://www.gnu.org/licenses/>.
16+
*/
17+
18+
#pragma once
19+
#include "waveform_config.hpp"
20+
#include <cstddef>
21+
#include <type_traits>
22+
#include <memory>
23+
#include <new>
24+
25+
// RAII uninitialized memory buffer with suitable alignment
26+
// for data processing on the target architecture.
27+
// 32-byte aligned on x86 with SIMD enabled,
28+
// otherwise default alignment of operator new.
29+
30+
template<typename T>
31+
class AlignedBuffer
32+
{
33+
public:
34+
static_assert(std::is_trivial_v<T>, "Only trivial types are supported");
35+
AlignedBuffer() = default;
36+
AlignedBuffer(const AlignedBuffer&) = delete;
37+
AlignedBuffer& operator=(const AlignedBuffer&) = delete;
38+
AlignedBuffer(AlignedBuffer&&) = default;
39+
AlignedBuffer& operator=(AlignedBuffer&&) = default;
40+
~AlignedBuffer() = default;
41+
42+
T& operator[](std::size_t i) const { return m_buf[i]; }
43+
T *get() const noexcept { return m_buf.get(); }
44+
explicit operator bool() const noexcept { return static_cast<bool>(m_buf); }
45+
46+
void reset() { m_buf.reset(); }
47+
void reset(std::size_t count) { m_buf.reset(alloc(count)); }
48+
49+
private:
50+
#ifndef DISABLE_X86_SIMD
51+
static constexpr std::size_t ALIGNMENT = ((alignof(T) > 32u) ? alignof(T) : 32u);
52+
#else
53+
static constexpr std::size_t ALIGNMENT = alignof(T);
54+
#endif // !DISABLE_X86_SIMD
55+
56+
T *alloc(std::size_t count)
57+
{
58+
if constexpr (ALIGNMENT > __STDCPP_DEFAULT_NEW_ALIGNMENT__)
59+
return static_cast<T*>(::operator new(sizeof(T) * count, std::align_val_t{ ALIGNMENT }));
60+
else
61+
return static_cast<T*>(::operator new(sizeof(T) * count));
62+
}
63+
64+
class Deleter
65+
{
66+
public:
67+
void operator()(void *p)
68+
{
69+
if constexpr (ALIGNMENT > __STDCPP_DEFAULT_NEW_ALIGNMENT__)
70+
::operator delete(p, std::align_val_t{ ALIGNMENT });
71+
else
72+
::operator delete(p);
73+
}
74+
};
75+
76+
friend bool operator==(const AlignedBuffer& a, std::nullptr_t) { return a.m_buf == nullptr; }
77+
friend bool operator!=(const AlignedBuffer& a, std::nullptr_t) { return a.m_buf != nullptr; }
78+
79+
std::unique_ptr<T[], Deleter> m_buf;
80+
};

0 commit comments

Comments
 (0)