Commit 097fd4b2 authored by Jaromír Mikeš's avatar Jaromír Mikeš

Imported Upstream version 20130612

parents
2013-05-25 (0.1.1) Robin Gareus <robin@gareus.org>
* update submodules
2013-05-25 (0.1.0) Robin Gareus <robin@gareus.org>
* add midifilter.lv plugis
2013-05-20 (0.0.1) Robin Gareus <robin@gareus.org>
* plugin collection
* intial debianization
#!/usr/bin/make
VERSION ?=$(shell date +%Y%m%d)
SUBDIRS = balance.lv2 convoLV2 nodelay.lv2 xfade.lv2 midifilter.lv2
all clean install uninstall: submodule_check $(SUBDIRS)
$(SUBDIRS)::
$(MAKE) -C $@ $(MAKECMDGOALS)
###############################################################################
TARNAME = x42-plugins
TARF=$(TARNAME)_$(VERSION).orig.tar
submodules:
git submodule init
git submodule update
tagupdate:
git submodule foreach git checkout master
git submodule foreach git pull
git submodule foreach 'git reset --hard $$(git describe --abbrev=0 --tags)'
-git commit $(SUBDIRS) -m "update submodules" \
-m "$(shell git submodule foreach git describe --tags | tr "\n" " " | sed 's/Entering /@ - /g' | tr "@" "\n")"
submodule_check:
-test -d .git && \
git submodule status \
| grep -q "^-" \
&& $(MAKE) submodules
dist: submodule_check tagupdate
$(eval VERSION := $(shell git submodule --quiet foreach git show -s --format="%ci" HEAD | cut -d' ' -f 1 | sed 's/-//g' | sort -nr | head -n 1))
git archive --prefix=$(TARNAME)-$(VERSION)/ --format tar HEAD > $(TARF)
$(eval TEMPFILE := $(shell mktemp))
git submodule foreach \
"git archive --prefix=$(TARNAME)-$(VERSION)/"'$$(basename $$(pwd))/'" --format tar HEAD > $(TEMPFILE); \
tar --concatenate -f ../$(TARF) $(TEMPFILE)";
rm $(TEMPFILE)
rm -f $(TARF).xz
xz $(TARF)
.PHONY: submodules update reset dist
x42-plugins
===========
Collection of LV2 plugins - git externals - ready for packaging.
see plugin.list for the list of included plugins.
Debian Package
--------------
```
./build-deb.sh -us -uc
```
Installation on non-debian systems
----------------------------------
```
make
sudo make install
```
This diff is collapsed.
2013-06-12 (0.4.1) Robin Gareus <robin@gareus.org>
* resize-port sz:minimumSize (fix jack1 issue)
* do not include production-files (xcf) in tar dist
2013-06-08 (0.4.0) Robin Gareus <robin@gareus.org>
* clean up build system (CFLAGS)
* fix meter-level text & alignment
* address some openGL rendering issues
* add LV2 plugin category
* built-in documentation & port annotation
2013-05-13 (0.3.3) Robin Gareus <robin@gareus.org>
* add state interface - save/restore level-meter config
2013-05-11 (0.3.2) Robin Gareus <robin@gareus.org>
* allow to configure meter (integration and peak-hold times)
* resizable window
* small tweaks to improve usability
2013-05-05 (0.3.1) Robin Gareus <robin@gareus.org>
* fix peak meter
* use absolute non-integrated max for peak-hold
2013-05-05 (0.3.0) Robin Gareus <robin@gareus.org>
* add phase-invert buttons in input stage
* add phase correlation meter
* IEC 60268-18 style meters
* do not calc levels/phase, nor send messages to UI, if UI is not visible
* use to FreeSansBold font as default
* various minor tweaks and fixes
2013-05-02 (0.2.0) Robin Gareus <robin@gareus.org>
* added openGL based UI
2013-05-01 (0.1.0) Robin Gareus <robin@gareus.org>
* initial version of panner with delaylines
#!/usr/bin/make -f
# these can be overridden using make variables. e.g.
# make CFLAGS=-O2
# make install DESTDIR=$(CURDIR)/debian/balance_lv2 PREFIX=/usr
#
OPTIMIZATIONS ?= -msse -msse2 -mfpmath=sse -ffast-math -fomit-frame-pointer -O3 -fno-finite-math-only
PREFIX ?= /usr/local
CFLAGS ?= $(OPTIMIZATIONS) -Wall
LIBDIR ?= lib
###############################################################################
LV2DIR ?= $(PREFIX)/$(LIBDIR)/lv2
LOADLIBES=-lm
LV2NAME=balance
LV2GUI=balanceUI
BUNDLE=balance.lv2
override CFLAGS+=-fPIC -std=c99
TX=textures/
IS_OSX=
UNAME=$(shell uname)
ifeq ($(UNAME),Darwin)
IS_OSX=yes
LV2LDFLAGS=-dynamiclib
LIB_EXT=.dylib
else
LV2LDFLAGS=-Wl,-Bstatic -Wl,-Bdynamic
LIB_EXT=.so
endif
targets=$(LV2NAME)$(LIB_EXT)
# check for build-dependencies
ifeq ($(shell pkg-config --exists lv2 || echo no), no)
$(error "LV2 SDK was not found")
else
override CFLAGS+=`pkg-config --cflags lv2`
endif
# optional UI
ifeq ($(IS_OSX), yes)
FONTFILE?=/usr/X11/lib/X11/fonts/TTF/VeraBd.ttf
FONTSIZE?=36
else
FONTFILE?=/usr/share/fonts/truetype/freefont/FreeSansBold.ttf
FONTSIZE?=40
endif
ifeq ($(shell test -f $(FONTFILE) || echo no ), no)
$(warning "!!")
$(warning "!! UI font can not be found on this system")
$(warning "!! install fonts-freefont-ttf or set the FONTFILE variable to a ttf file")
$(warning "!! LV2 GUI will not be built")
$(warning "!!")
FONT_FOUND=no
else
FONT_FOUND=yes
endif
ifeq ($(IS_OSX), yes)
HAVE_UI=$(shell pkg-config --exists ftgl && echo $(FONT_FOUND))
else
HAVE_UI=$(shell pkg-config --exists glu ftgl && echo $(FONT_FOUND))
endif
LV2UIREQ=
# check for LV2 idle thread -- requires 'lv2', atleast_version='1.4.6
ifeq ($(shell pkg-config --atleast-version=1.4.6 lv2 || echo no), no)
UICFLAGS+=-DOLD_SUIL
else
LV2UIREQ=lv2:requiredFeature ui:idleInterface;\\n\\tlv2:extensionData ui:idleInterface;
endif
ifeq ($(HAVE_UI), yes)
UIDEPS=pugl/pugl.h pugl/pugl_internal.h ui_model.h
UIDEPS+=$(TX)dial.c $(TX)background.c
UIDEPS+=$(TX)mm_lr.c $(TX)mm_rl.c $(TX)mm_ll.c $(TX)mm_rr.c $(TX)mm_mono.c
UIDEPS+=$(TX)btn_inv.c $(TX)btn_link.c
ifeq ($(IS_OSX), yes)
UIDEPS+=pugl/pugl_osx.m
UILIBS=pugl/pugl_osx.m -framework Cocoa -framework OpenGL
UI_TYPE=CocoaUI
else
UIDEPS+=pugl/pugl_x11.c
UICFLAGS+=`pkg-config --cflags glu`
UILIBS=pugl/pugl_x11.c -lX11 `pkg-config --libs glu`
UI_TYPE=X11UI
endif
override CFLAGS+=`pkg-config --cflags ftgl`
UILIBS+=`pkg-config --libs ftgl`
override CFLAGS+=-DFONTFILE=\"$(FONTFILE)\"
override CFLAGS+=-DFONTSIZE=$(FONTSIZE)
targets+=$(LV2GUI)$(LIB_EXT)
else
$(warning "!!")
$(warning "!! openGL/GLU is not available - GUI disabled")
$(warning "!! install glu-dev, ftgl-dev and fonts-freefont-ttf to build LV2 GUI")
$(warning "!!")
endif
# build target definitions
default: all
all: manifest.ttl $(LV2NAME).ttl $(targets)
manifest.ttl: manifest.ttl.in manifest.ui.ttl.in
sed "s/@LV2NAME@/$(LV2NAME)/;s/@LIB_EXT@/$(LIB_EXT)/" \
manifest.ttl.in > manifest.ttl
ifeq ($(HAVE_UI), yes)
sed "s/@LV2NAME@/$(LV2NAME)/;s/@LV2GUI@/$(LV2GUI)/;s/@LIB_EXT@/$(LIB_EXT)/;s/@UI_TYPE@/$(UI_TYPE)/" manifest.ui.ttl.in >> manifest.ttl
endif
$(LV2NAME).ttl: $(LV2NAME).ttl.in $(LV2NAME).ui.ttl.in
cat $(LV2NAME).ttl.in > $(LV2NAME).ttl
ifeq ($(HAVE_UI), yes)
sed "s/@UI_TYPE@/$(UI_TYPE)/;s/@UI_REQ@/$(LV2UIREQ)/;" $(LV2NAME).ui.ttl.in >> $(LV2NAME).ttl
endif
$(LV2NAME)$(LIB_EXT): balance.c uris.h
$(CC) $(CPPFLAGS) $(CFLAGS) \
-o $(LV2NAME)$(LIB_EXT) balance.c \
-shared $(LV2LDFLAGS) $(LDFLAGS) $(LOADLIBES)
$(LV2GUI)$(LIB_EXT): ui.c uris.h $(UIDEPS)
$(CC) $(CPPFLAGS) $(CFLAGS) $(UICFLAGS) \
-o $(LV2GUI)$(LIB_EXT) ui.c \
-shared $(LV2LDFLAGS) $(LDFLAGS) $(UILIBS)
# install/uninstall/clean target definitions
install: all
install -d $(DESTDIR)$(LV2DIR)/$(BUNDLE)
install -m755 $(LV2NAME)$(LIB_EXT) $(DESTDIR)$(LV2DIR)/$(BUNDLE)
install -m644 manifest.ttl $(LV2NAME).ttl $(DESTDIR)$(LV2DIR)/$(BUNDLE)
ifeq ($(HAVE_UI), yes)
install -m755 $(LV2GUI)$(LIB_EXT) $(DESTDIR)$(LV2DIR)/$(BUNDLE)
endif
uninstall:
rm -f $(DESTDIR)$(LV2DIR)/$(BUNDLE)/manifest.ttl
rm -f $(DESTDIR)$(LV2DIR)/$(BUNDLE)/$(LV2NAME).ttl
rm -f $(DESTDIR)$(LV2DIR)/$(BUNDLE)/$(LV2NAME)$(LIB_EXT)
rm -f $(DESTDIR)$(LV2DIR)/$(BUNDLE)/$(LV2GUI)$(LIB_EXT)
-rmdir $(DESTDIR)$(LV2DIR)/$(BUNDLE)
clean:
rm -f manifest.ttl balance.ttl $(LV2NAME)$(LIB_EXT) $(LV2GUI)$(LIB_EXT)
.PHONY: clean all install uninstall
balance.lv2 - LV2 stereo balance
================================
balance.lv2 is an audio-plugin for stereo balance control with
optional per channel delay.
balance.lv2 facilitates adjusting stereo-microphone recordings (X-Y, A-B, ORTF).
But it also generally useful as "Input Channel Conditioner".
It allows for attenuating the signal on one of the channels as well as
delaying the signals (move away from the microphone).
To round off the feature-set channels can be swapped or the signal can be
downmixed to mono after the delay.
It features a Phase-Correlation meter as well as peak programme meters
according to IEC 60268-18 (5ms integration, 20dB/1.5 sec fall-off)
for input and output signals.
Install
-------
Compiling this plugin requires LV2 SDK (lv2 lv2core), gnu-make and a c-compiler.
The optional UI depends on libftgl-dev, libglu-dev, libx11-dev and the
fonts-freefont-ttf (or any other .ttf font).
```bash
git clone git://github.com/x42/balance.lv2.git
cd balance.lv2
make
sudo make install PREFIX=/usr
# test run
jalv.gtk http://gareus.org/oss/lv2/balance
```
Note to packagers: The Makefile honors `PREFIX` and `DESTDIR` variables as well
as `CFLAGS`, `LDFLAGS` and `OPTIMIZATIONS` (additions to `CFLAGS`).
Signal Flow & Controls
----------------------
![signal flow](https://raw.github.com/x42/balance.lv2/master/doc/signal_flow.png "Signal Flow")
The plugin has six control inputs, all of which are interpolated and can
be automated or changed dynamically without introducing clicks.
### Trim
Simple gain stage to amplify or attenuate the signal by at most 20dB.
This knob equally affects both channels.
This stage also allows to individually invert the phase of each channel.
### Balance
Left/Right signal level balance control.
*Gain Mode* defines the behaviour of the *Balance* knob.
* classic "Balance" mode.
* Attenuate one channels at a time; no positive gain.
* 100% left: mute the right channel, left channel is untouched.
* 50% left: attenuate the right channel by -6dB (signal * 0.5), left channel is untouched.
* 29% left: attenuate the right channel by -3dB (signal * 0.71), left channel is untouched.
* 50% right: attenuate the left channel by -6dB (signal * 0.5), right channel is untouched.
* ...
* "Unity Gain - Equal Amplitude" mode
* behaviour of the attenuated channel is identical to "Balance" mode.
Gain of the previously untouched channel is raised so that the mono sum of both retains equal amplitude.
* 100% right: -inf dB on left channel (signal * 0.0), +6dB on right channel (signal * 2.0).
* 50% left: attenuate the right channel by -6dB (signal * 0.5), left channel is amplified by +3.5dB (signal * 1.5)
* 29% left: -3.0 dB (signal * .71) on left channel, +2.2dB (signal * 1.29) on right channel.
* ...
* "Seesaw - Equal Power" mode
* -6dB .. +6dB range, equal power distribution
* The signal is at full-level in center position and becomes progressively louder as it is panned to the right or left.
* The overall slider range is identical to the other modes.
Values > 50%..100% in either direction are fixed to +-6dB.
* 100% right: -6dB on left channel and +6dB on right channel.
* 50% right: -6dB on left channel and +6dB on right channel (!).
* 29% right: -3dB on left channel and +3dB on right channel.
Regardless of the Gain Mode, at center position the signal remains unmodified.
### Delay
Allow to delay the signal of either channel to correct the stereo field (signal runtime) or correct phase alignment.
### Channel Map
The "Downmix to Mono" option will attenuate the output by -6dB. Other options will simply copy
the result to selected channel(s).
Screenshots
-----------
The plugin comes with a built-in optional user interface.
![screenshot](https://raw.github.com/x42/balance.lv2/master/doc/screenshot_ui.png "Built-in openGL GUI")
![screenshot](https://raw.github.com/x42/balance.lv2/master/doc/screenshot_ardour.png "Basic controls in Ardour")
Thanks
------
Many thanks to all who contributed ideas and feedback. In particular
Chris 'oofus' Goddard, who inspired the current signal flow, provided
the diagram and beta-tested the plugin. As well as tom^_ for feedback
on the GUI in general.
This diff is collapsed.
@prefix atom: <http://lv2plug.in/ns/ext/atom#> .
@prefix doap: <http://usefulinc.com/ns/doap#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix lv2: <http://lv2plug.in/ns/lv2core#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix pg: <http://lv2plug.in/ns/ext/port-groups#> .
@prefix units: <http://lv2plug.in/ns/extensions/units#> .
@prefix urid: <http://lv2plug.in/ns/ext/urid#> .
@prefix state: <http://lv2plug.in/ns/ext/state#> .
@prefix rsz: <http://lv2plug.in/ns/ext/resize-port#> .
<http://gareus.org/rgareus#me>
a foaf:Person ;
foaf:name "Robin Gareus" ;
foaf:mbox <mailto:robin@gareus.org> ;
foaf:homepage <http://gareus.org/> .
<http://gareus.org/oss/lv2/balance>
a lv2:Plugin, lv2:SpatialPlugin , doap:Project;
doap:license <http://usefulinc.com/doap/licenses/gpl> ;
doap:maintainer <http://gareus.org/rgareus#me> ;
doap:name "Stereo Balance Control";
lv2:optionalFeature lv2:hardRTCapable ;
lv2:requiredFeature urid:map ;
lv2:extensionData state:interface ;
rdfs:comment """balance.lv2 facilitates adjusting stereo-microphone recordings (X-Y, A-B, ORTF). But it also generally useful as 'Input Channel Conditioner'.
It allows for attenuating the signal on one of the channels as well as delaying the signals (move away from the microphone). To round off the feature-set channels can be swapped or the signal can be downmixed to mono after the delay.
It features a Phase-Correlation meter as well as peak programme meters according to IEC 60268-18 (5ms integration, 20dB/1.5 sec fall-off) for input and output signals.
The meters can be configure on the right side of the GUI, tilt it using the 'a' key.""" ;
lv2:port [
a lv2:InputPort ,
lv2:ControlPort ;
lv2:index 0 ;
lv2:symbol "trim" ;
lv2:name "Trim/Gain [dB]";
lv2:default 0.0 ;
lv2:minimum -20.0 ;
lv2:maximum 20.0 ;
units:unit units:db;
] , [
a lv2:InputPort ,
lv2:ControlPort ;
lv2:index 1 ;
lv2:symbol "phaseL" ;
lv2:name "Phase Invert Left";
lv2:default 0.0 ;
lv2:minimum 0.0 ;
lv2:maximum 1.0 ;
lv2:portProperty lv2:integer, lv2:toggled;
] , [
a lv2:InputPort ,
lv2:ControlPort ;
lv2:index 2 ;
lv2:symbol "phaseR" ;
lv2:name "Phase Invert Right";
lv2:default 0.0 ;
lv2:minimum 0.0 ;
lv2:maximum 1.0 ;
lv2:portProperty lv2:integer, lv2:toggled;
] , [
a lv2:InputPort ,
lv2:ControlPort ;
lv2:index 3 ;
lv2:symbol "balance" ;
lv2:name "Balance L/R";
lv2:default 0.0 ;
lv2:minimum -1.0 ;
lv2:maximum 1.0 ;
] , [
a lv2:InputPort ,
lv2:ControlPort ;
lv2:index 4 ;
lv2:symbol "unitygain" ;
lv2:name "Gain Mode" ;
lv2:default 0 ;
lv2:minimum 0 ;
lv2:maximum 2;
lv2:portProperty lv2:enumeration;
lv2:scalePoint [
rdfs:label "Balance" ;
rdf:value 0
] , [
rdfs:label "Unity Gain - Equal Amplitude" ;
rdf:value 1
] , [
rdfs:label "Seesaw - Equal Power" ;
rdf:value 2
];
rdfs:comment """The mode defines the behaviour of the balance control.
classic 'Balance' mode: Attenuate one channels at a time; no positive gain.
'Unity Gain - Equal Amplitude' mode: the behaviour of the attenuated channel is identical to 'Balance' mode. The gain of the previously untouched channel is raised so that the mono sum of both retains equal amplitude.
'Seesaw - Equal Power' mode: -6dB .. +6dB range, equal power distribution"""
] , [
a lv2:InputPort ,
lv2:ControlPort ;
lv2:index 5 ;
lv2:symbol "delayLeft" ;
lv2:name "Delay Left [samples]";
lv2:default 0 ;
lv2:minimum 0 ;
lv2:maximum 2000 ;
lv2:portProperty lv2:integer;
] , [
a lv2:InputPort ,
lv2:ControlPort ;
lv2:index 6 ;
lv2:symbol "delayRight" ;
lv2:name "Delay Right [samples]";
lv2:default 0 ;
lv2:minimum 0 ;
lv2:maximum 2000 ;
lv2:portProperty lv2:integer;
] , [
a lv2:InputPort ,
lv2:ControlPort ;
lv2:index 7 ;
lv2:symbol "monoswap" ;
lv2:name "Channel Assignment" ;
lv2:default 0 ;
lv2:minimum 0 ;
lv2:maximum 4;
lv2:portProperty lv2:enumeration;
lv2:scalePoint [
rdfs:label "L->L, R->R (Straight)" ;
rdf:value 0
] , [
rdfs:label "L->L, L->R (Left Channel Mono)" ;
rdf:value 1
] , [
rdfs:label "R->R, R->L (Right Channel Mono)" ;
rdf:value 2
] , [
rdfs:label "L->R, R->L (Swap Channels)" ;
rdf:value 3
] , [
rdfs:label "Downmix to Mono" ;
rdf:value 4
]
] , [
a lv2:AudioPort ,
lv2:InputPort ;
lv2:index 8 ;
lv2:symbol "in_left" ;
lv2:name "In Left" ;
lv2:designation pg:left ;
] , [
a lv2:AudioPort ,
lv2:InputPort ;
lv2:index 9 ;
lv2:symbol "in_right" ;
lv2:name "In Right" ;
lv2:designation pg:right ;
] , [
a lv2:AudioPort ,
lv2:OutputPort ;
lv2:index 10 ;
lv2:symbol "out_left" ;
lv2:name "Out Left" ;
lv2:designation pg:left ;
] , [
a lv2:AudioPort ,
lv2:OutputPort ;
lv2:index 11 ;
lv2:symbol "out_right" ;
lv2:name "Out Right" ;
lv2:designation pg:right ;
] , [
a atom:AtomPort ,
lv2:InputPort ;
atom:bufferType atom:Sequence ;
lv2:designation lv2:control ;
atom:supports <http://gareus.org/oss/lv2/balance#control> ;
lv2:index 12 ;
lv2:symbol "control" ;
lv2:name "UI to plugin communication"
] , [
a atom:AtomPort ,
lv2:OutputPort ;
atom:bufferType atom:Sequence ;
lv2:designation lv2:control ;
atom:supports <http://gareus.org/oss/lv2/balance#control> ;
lv2:index 13 ;
lv2:symbol "notify" ;
lv2:name "plugin to UI communication" ;
rsz:minimumSize 1024;
] .
@prefix ui: <http://lv2plug.in/ns/extensions/ui#> .
<http://gareus.org/oss/lv2/balance>
ui:ui <http://gareus.org/oss/lv2/balance#ui> ;
.
<http://gareus.org/oss/lv2/balance#ui>
a ui:@UI_TYPE@;
lv2:requiredFeature urid:map ;
@UI_REQ@
ui:portNotification [
ui:plugin <http://gareus.org/oss/lv2/balance> ;
lv2:symbol "notify";
ui:notifyType atom:Blank
]
.
@prefix lv2: <http://lv2plug.in/ns/lv2core#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix ui: <http://lv2plug.in/ns/extensions/ui#> .
<http://gareus.org/oss/lv2/@LV2NAME@>
a lv2:Plugin ;
lv2:binary <@LV2NAME@@LIB_EXT@> ;
rdfs:seeAlso <@LV2NAME@.ttl> .
<http://gareus.org/oss/lv2/@LV2NAME@#ui>
a ui:@UI_TYPE@;
ui:binary <@LV2GUI@@LIB_EXT@> ;
rdfs:seeAlso <@LV2NAME@.ttl> .
/*
Copyright 2012 David Robillard <http://drobilla.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/**
@file pugl.h API for Pugl, a minimal portable API for OpenGL.
*/
#ifndef PUGL_H_INCLUDED
#define PUGL_H_INCLUDED
#include <stdint.h>
/*
This API is pure portable C and contains no platform specific elements, or
even a GL dependency. However, unfortunately GL includes vary across
platforms so they are included here to allow for pure portable programs.
*/
#ifdef __APPLE__
# include "OpenGL/gl.h"
#else
# ifdef _WIN32
# include <windows.h> /* Broken Windows GL headers require this */
# endif
# include "GL/gl.h"
#endif
#ifdef PUGL_SHARED
# ifdef _WIN32
# define PUGL_LIB_IMPORT __declspec(dllimport)
# define PUGL_LIB_EXPORT __declspec(dllexport)
# else
# define PUGL_LIB_IMPORT __attribute__((visibility("default")))
# define PUGL_LIB_EXPORT __attribute__((visibility("default")))
# endif
# ifdef PUGL_INTERNAL
# define PUGL_API PUGL_LIB_EXPORT
# else
# define PUGL_API PUGL_LIB_IMPORT
# endif
#else
# define PUGL_API
#endif
#ifdef __cplusplus
extern "C" {
#else
# include <stdbool.h>
#endif
/**
@defgroup pugl Pugl
A minimal portable API for OpenGL.
@{
*/
/**
An OpenGL view.
*/
typedef struct PuglViewImpl PuglView;
/**
A native window handle.
On X11, this is a Window.
On OSX, this is an NSView*.
On Windows, this is a HWND.
*/
typedef intptr_t PuglNativeWindow;
/**
Return status code.
*/
typedef enum {
PUGL_SUCCESS = 0
} PuglStatus;
/**
Convenience symbols for ASCII control characters.
*/
typedef enum {
PUGL_CHAR_BACKSPACE = 0x08,
PUGL_CHAR_ESCAPE = 0x1B,
PUGL_CHAR_DELETE = 0x7F
} PuglChar;
/**
Special (non-Unicode) keyboard keys.
*/
typedef enum {
PUGL_KEY_F1 = 1,
PUGL_KEY_F2,
PUGL_KEY_F3,
PUGL_KEY_F4,
PUGL_KEY_F5,
PUGL_KEY_F6,
PUGL_KEY_F7,
PUGL_KEY_F8,
PUGL_KEY_F9,
PUGL_KEY_F10,
PUGL_KEY_F11,
PUGL_KEY_F12,
PUGL_KEY_LEFT,
PUGL_KEY_UP,
PUGL_KEY_RIGHT,
PUGL_KEY_DOWN,
PUGL_KEY_PAGE_UP,
PUGL_KEY_PAGE_DOWN,
PUGL_KEY_HOME,
PUGL_KEY_END,
PUGL_KEY_INSERT,
PUGL_KEY_SHIFT,
PUGL_KEY_CTRL,
PUGL_KEY_ALT,
PUGL_KEY_SUPER,
} PuglKey;
/**
Keyboard modifier flags.
*/
typedef enum {
PUGL_MOD_SHIFT = 1, /**< Shift key */
PUGL_MOD_CTRL = 1 << 1, /**< Control key */
PUGL_MOD_ALT = 1 << 2, /**< Alt/Option key */