Compare commits
10 Commits
3cc5e226aa
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 4db05c1c73 | |||
| 065d31f1c9 | |||
|
|
6fc0e32da2 | ||
|
|
427d1bbf98 | ||
|
|
41ff60c8d0 | ||
|
|
1158a396a3 | ||
|
|
d660eb35ac | ||
|
|
32de8029bb | ||
|
|
e904d08e32 | ||
|
|
a47fd9ee3f |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1 +1,3 @@
|
|||||||
build/
|
build/
|
||||||
|
buildScript.sh
|
||||||
|
shaders/glava/rc_test.glsl
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
|
|
||||||
|
***Note:*** *This fork of GLava introduces support for the JACK Audio Connector Kit.*
|
||||||
|
|
||||||
<img align="left" width="200" height="200" src="https://thumbs.gfycat.com/DefiantInformalIndianspinyloach-size_restricted.gif" />
|
<img align="left" width="200" height="200" src="https://thumbs.gfycat.com/DefiantInformalIndianspinyloach-size_restricted.gif" />
|
||||||
|
|
||||||
**GLava** is a general-purpose, highly configurable OpenGL audio spectrum visualizer for X11. Displayed to the left is the `radial` shader module, or for a more extensive demonstration [see this demo](https://streamable.com/dgpj8). Development is active, and reporting issues is encouranged.
|
**GLava** is a general-purpose, highly configurable OpenGL audio spectrum visualizer for X11. Displayed to the left is the `radial` shader module, or for a more extensive demonstration [see this demo](https://streamable.com/dgpj8). Development is active, and reporting issues is encouranged.
|
||||||
@@ -35,6 +37,7 @@ Note that versions since `2.0` use Meson for the build system, although the `Mak
|
|||||||
|
|
||||||
- Meson
|
- Meson
|
||||||
- OBS (disable with `-Ddisable-obs=true`)
|
- OBS (disable with `-Ddisable-obs=true`)
|
||||||
|
- JACK
|
||||||
|
|
||||||
**Optional requirements:**
|
**Optional requirements:**
|
||||||
|
|
||||||
@@ -84,7 +87,7 @@ GLava aims to be compatible with _most_ EWMH compliant window managers. Below is
|
|||||||
| spectrwm |  | Defaults to unmanaged
|
| spectrwm |  | Defaults to unmanaged
|
||||||
| EXWM |  | EXWM does not have a desktop, and forces window decorations
|
| EXWM |  | EXWM does not have a desktop, and forces window decorations
|
||||||
| Enlightenment |  | Needs testing
|
| Enlightenment |  | Needs testing
|
||||||
| Xmonad |  | Needs testing
|
| Xmonad |  | No issues after enabling ewmh hints via `XMonad.Hooks.EwmhDesktops.ewmh`
|
||||||
| Any non EWMH-compliant WM |  | Window types and hints will not work if the window manager does not support the EWMH standards.
|
| Any non EWMH-compliant WM |  | Window types and hints will not work if the window manager does not support the EWMH standards.
|
||||||
|
|
||||||
Note that some WMs listed without issues have specific overrides when using the `--desktop` flag. See `shaders/env_*.glsl` files for details.
|
Note that some WMs listed without issues have specific overrides when using the `--desktop` flag. See `shaders/env_*.glsl` files for details.
|
||||||
|
|||||||
@@ -6,11 +6,11 @@
|
|||||||
static glava_handle handle;
|
static glava_handle handle;
|
||||||
|
|
||||||
static void handle_term (int _) {
|
static void handle_term (int _) {
|
||||||
printf("Interrupt recieved, closing...\n");
|
printf("Interrupt received, closing...\n");
|
||||||
glava_terminate(&handle);
|
glava_terminate(&handle);
|
||||||
}
|
}
|
||||||
static void handle_reload(int _) {
|
static void handle_reload(int _) {
|
||||||
printf("User signal recieved, reloading...\n");
|
printf("User signal received, reloading...\n");
|
||||||
glava_reload(&handle);
|
glava_reload(&handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -76,8 +76,8 @@ static volatile bool reload = false;
|
|||||||
|
|
||||||
__attribute__((noreturn, visibility("default"))) void glava_return_builtin(void) { exit(EXIT_SUCCESS); }
|
__attribute__((noreturn, visibility("default"))) void glava_return_builtin(void) { exit(EXIT_SUCCESS); }
|
||||||
__attribute__((noreturn, visibility("default"))) void glava_abort_builtin (void) { exit(EXIT_FAILURE); }
|
__attribute__((noreturn, visibility("default"))) void glava_abort_builtin (void) { exit(EXIT_FAILURE); }
|
||||||
__attribute__((noreturn, visibility("default"))) void (*glava_return) (void) = glava_return_builtin;
|
__attribute__((noreturn, visibility("default"))) static void (*glava_return) (void) = glava_return_builtin;
|
||||||
__attribute__((noreturn, visibility("default"))) void (*glava_abort) (void) = glava_abort_builtin;
|
__attribute__((noreturn, visibility("default"))) static void (*glava_abort) (void) = glava_abort_builtin;
|
||||||
|
|
||||||
/* Copy installed shaders/configuration from the installed location
|
/* Copy installed shaders/configuration from the installed location
|
||||||
(usually /etc/xdg). Modules (folders) will be linked instead of
|
(usually /etc/xdg). Modules (folders) will be linked instead of
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ struct glava_renderer;
|
|||||||
/* External API */
|
/* External API */
|
||||||
|
|
||||||
typedef struct glava_renderer* volatile glava_handle;
|
typedef struct glava_renderer* volatile glava_handle;
|
||||||
__attribute__((noreturn, visibility("default"))) void (*glava_abort) (void);
|
__attribute__((noreturn, visibility("default"))) static void (*glava_abort) (void);
|
||||||
__attribute__((noreturn, visibility("default"))) void (*glava_return) (void);
|
__attribute__((noreturn, visibility("default"))) static void (*glava_return) (void);
|
||||||
__attribute__((visibility("default"))) void glava_assign_external_ctx (void* ctx);
|
__attribute__((visibility("default"))) void glava_assign_external_ctx (void* ctx);
|
||||||
__attribute__((visibility("default"))) void glava_entry (int argc, char** argv, glava_handle* ret);
|
__attribute__((visibility("default"))) void glava_entry (int argc, char** argv, glava_handle* ret);
|
||||||
__attribute__((visibility("default"))) void glava_terminate (glava_handle* ref);
|
__attribute__((visibility("default"))) void glava_terminate (glava_handle* ref);
|
||||||
|
|||||||
115
glava/jack_input.c
Normal file
115
glava/jack_input.c
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <jack/jack.h>
|
||||||
|
|
||||||
|
#include "fifo.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* GLava backend and configuration */
|
||||||
|
struct audio_data *audio;
|
||||||
|
size_t buffer_size;
|
||||||
|
|
||||||
|
/* JACK backend */
|
||||||
|
jack_client_t *client;
|
||||||
|
jack_port_t *input_port1, *input_port2;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Callback function for JACK.
|
||||||
|
* Appends new samples to GLava buffer and marks it as modified.
|
||||||
|
*/
|
||||||
|
int process (jack_nframes_t nframes, void *arg) {
|
||||||
|
float* samples1 = (jack_default_audio_sample_t*)jack_port_get_buffer
|
||||||
|
(input_port1, nframes);
|
||||||
|
float* samples2 = (jack_default_audio_sample_t*)jack_port_get_buffer
|
||||||
|
(input_port2, nframes);
|
||||||
|
|
||||||
|
pthread_mutex_lock(&audio->mutex);
|
||||||
|
float* bl = (float*) audio->audio_out_l;
|
||||||
|
float* br = (float*) audio->audio_out_r;
|
||||||
|
|
||||||
|
size_t buffer_steps = (size_t) nframes;
|
||||||
|
size_t buffer_offset = buffer_size - buffer_steps;
|
||||||
|
memmove(bl, &bl[buffer_steps], buffer_offset * sizeof(float));
|
||||||
|
memmove(br, &br[buffer_steps], buffer_offset * sizeof(float));
|
||||||
|
|
||||||
|
for (int frame = 0; frame < buffer_steps; frame++) {
|
||||||
|
bl[buffer_offset + frame] = samples1[frame];
|
||||||
|
br[buffer_offset + frame] = samples2[frame];
|
||||||
|
}
|
||||||
|
|
||||||
|
audio->modified = true;
|
||||||
|
pthread_mutex_unlock(&audio->mutex);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void jack_shutdown (void *arg) {
|
||||||
|
//Do more cleanup here if needed
|
||||||
|
}
|
||||||
|
|
||||||
|
static void init(struct audio_data* audio) {
|
||||||
|
if (!audio->source)
|
||||||
|
audio->source = strdup ("JACK");
|
||||||
|
|
||||||
|
const char *client_name = "GLava";
|
||||||
|
const char *server_name = NULL;
|
||||||
|
jack_options_t options = JackNullOption;
|
||||||
|
jack_status_t status;
|
||||||
|
client = jack_client_open (client_name, options, &status, server_name);
|
||||||
|
|
||||||
|
if (client == NULL) {
|
||||||
|
fprintf (stderr, "jack_client_open() failed, status = 0x%2.0x\n",
|
||||||
|
status);
|
||||||
|
if (status & JackServerFailed) {
|
||||||
|
printf ("Unable to connect to JACK server!\n");
|
||||||
|
}
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
if (status & JackServerStarted) {
|
||||||
|
fprintf (stdout, "JACK server started\n");
|
||||||
|
}
|
||||||
|
if (status & JackNameNotUnique) {
|
||||||
|
client_name = jack_get_client_name (client);
|
||||||
|
fprintf (stderr, "Unique name '%s' assigned!\n", client_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
jack_on_shutdown (client, jack_shutdown, 0);
|
||||||
|
|
||||||
|
input_port1 = jack_port_register (client, "input1", JACK_DEFAULT_AUDIO_TYPE,
|
||||||
|
JackPortIsInput, 0);
|
||||||
|
input_port2 = jack_port_register (client, "input2", JACK_DEFAULT_AUDIO_TYPE,
|
||||||
|
JackPortIsInput, 0);
|
||||||
|
|
||||||
|
if ((input_port1 == NULL) || (input_port2 == NULL)) {
|
||||||
|
fprintf (stderr, "No more JACK ports available!\n");
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void* entry(void* data) {
|
||||||
|
audio = (struct audio_data *) data;
|
||||||
|
buffer_size = audio->audio_buf_sz;
|
||||||
|
|
||||||
|
jack_set_process_callback (client, process, NULL);
|
||||||
|
if (jack_activate (client)) {
|
||||||
|
fprintf (stderr, "Cannot activate client!\n");
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
sleep(1);
|
||||||
|
|
||||||
|
if (audio->terminate == 1) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
jack_client_close (client);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
AUDIO_ATTACH (jack);
|
||||||
7
glava/jack_input.h
Normal file
7
glava/jack_input.h
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
#ifndef JACK_INPUT_H
|
||||||
|
#define JACK_INPUT_H
|
||||||
|
|
||||||
|
#include "fifo.h"
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -30,6 +30,8 @@ extern "C" {
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <error.h>
|
#include <error.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <errno.h>
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef GLFFT_GLSL_LANG_STRING
|
#ifndef GLFFT_GLSL_LANG_STRING
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include "glfft_interface.hpp"
|
#include "glfft_interface.hpp"
|
||||||
#include "glfft.hpp"
|
#include "glfft.hpp"
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
/* GLAVA NOTICE: automatic wisdom serialization support may be added at a late date */
|
/* GLAVA NOTICE: automatic wisdom serialization support may be added at a late date */
|
||||||
#ifdef GLFFT_SERIALIZATION
|
#ifdef GLFFT_SERIALIZATION
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ glava_dependencies = [
|
|||||||
cc.find_library('dl'),
|
cc.find_library('dl'),
|
||||||
cc.find_library('m'),
|
cc.find_library('m'),
|
||||||
cc.find_library('X11'),
|
cc.find_library('X11'),
|
||||||
cc.find_library('Xext')
|
cc.find_library('Xext'),
|
||||||
|
cc.find_library('jack')
|
||||||
]
|
]
|
||||||
|
|
||||||
if cc.get_id() == 'clang'
|
if cc.get_id() == 'clang'
|
||||||
|
|||||||
Reference in New Issue
Block a user