Skip to content

Commit

Permalink
Apply UniversalIndentGUI on c/h source files.
Browse files Browse the repository at this point in the history
  • Loading branch information
belangeo committed Sep 16, 2020
1 parent 5678c79 commit 9306151
Show file tree
Hide file tree
Showing 73 changed files with 45,721 additions and 28,707 deletions.
410 changes: 223 additions & 187 deletions externals/externalmodule-template.c

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions externals/externalmodule-template.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/**************************************************
Declare each external object type as "extern" to be sure
that the pyomodule will be aware of their existence.
/**************************************************
Declare each external object type as "extern" to be sure
that the pyomodule will be aware of their existence.
**************************************************/
extern PyTypeObject GainType;

/**********************************************************
This macro is called at runtime to include external objects
/**********************************************************
This macro is called at runtime to include external objects
in "_pyo" module. Add a line calling "module_add_object"
with your object's name and type for each external object.
**********************************************************/
Expand Down
12 changes: 6 additions & 6 deletions include/ad_coreaudio.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
#include "servermodule.h"

OSStatus coreaudio_input_callback(AudioDeviceID device, const AudioTimeStamp* inNow,
const AudioBufferList* inInputData,
const AudioTimeStamp* inInputTime,
AudioBufferList* outOutputData,
const AudioTimeStamp* inOutputTime,
void* defptr);
const AudioBufferList* inInputData,
const AudioTimeStamp* inInputTime,
AudioBufferList* outOutputData,
const AudioTimeStamp* inOutputTime,
void* defptr);
OSStatus coreaudio_output_callback(AudioDeviceID device, const AudioTimeStamp* inNow,
const AudioBufferList* inInputData,
const AudioTimeStamp* inInputTime,
Expand All @@ -42,5 +42,5 @@ int Server_coreaudio_deinit(Server *self);
int Server_coreaudio_start(Server *self);
int Server_coreaudio_stop(Server *self);

#endif
#endif
/* _AD_COREAUDIO_H */
8 changes: 5 additions & 3 deletions include/ad_jack.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,16 @@
#include <jack/midiport.h>
#include "servermodule.h"

typedef struct {
typedef struct
{
unsigned long timestamp;
int status;
int data1;
int data2;
} PyoJackMidiEvent;

typedef struct {
typedef struct
{
int activated;
jack_client_t *jack_client;
jack_port_t **jack_in_ports;
Expand Down Expand Up @@ -60,5 +62,5 @@ void jack_pressout(Server *self, int value, int chan, long timestamp);
void jack_bendout(Server *self, int value, int chan, long timestamp);
void jack_makenote(Server *self, int pit, int vel, int dur, int chan);

#endif
#endif
/* _AD_JACK_H */
3 changes: 2 additions & 1 deletion include/ad_portaudio.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
#include "portaudio.h"
#include "servermodule.h"

typedef struct {
typedef struct
{
PaStream *stream;
} PyoPaBackendData;

Expand Down
7 changes: 4 additions & 3 deletions include/dummymodule.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
#include <Python.h>
#include "pyomodule.h"

typedef struct {
typedef struct
{
pyo_audio_HEAD
PyObject *input;
Stream *input_stream;
Expand All @@ -30,6 +31,6 @@ typedef struct {

extern PyObject * Dummy_initialize(Dummy *self);

#define MAKE_NEW_DUMMY(self, type, rt_error) \
(self) = (Dummy *)(type)->tp_alloc((type), 0); \
#define MAKE_NEW_DUMMY(self, type, rt_error) \
(self) = (Dummy *)(type)->tp_alloc((type), 0); \
if ((self) == rt_error) { return rt_error; }
9 changes: 5 additions & 4 deletions include/matrixmodule.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,18 @@

#ifdef __MATRIX_MODULE

typedef struct {
typedef struct
{
PyObject_HEAD
int width;
int height;
MYFLT **data;
} MatrixStream;


#define MAKE_NEW_MATRIXSTREAM(self, type, rt_error) \
(self) = (MatrixStream *)(type)->tp_alloc((type), 0); \
if ((self) == rt_error) { return rt_error; } \
#define MAKE_NEW_MATRIXSTREAM(self, type, rt_error) \
(self) = (MatrixStream *)(type)->tp_alloc((type), 0); \
if ((self) == rt_error) { return rt_error; } \
\
(self)->width = (self)->height = 0

Expand Down
3 changes: 2 additions & 1 deletion include/md_portmidi.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
#include "porttime.h"
#include "servermodule.h"

typedef struct {
typedef struct
{
PmStream *midiin[64];
PmStream *midiout[64];
} PyoPmBackendData;
Expand Down
3 changes: 2 additions & 1 deletion include/pvstreammodule.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
#include <Python.h>
#include "pyomodule.h"

typedef struct {
typedef struct
{
PyObject_HEAD
int fftsize;
int olaps;
Expand Down
2 changes: 1 addition & 1 deletion include/py2to3.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@

/* Unicode/string handling. */
#if PY_MAJOR_VERSION >= 3
#define PY_STRING_CHECK(a) PyUnicode_Check(a)
#define PY_STRING_CHECK(a) PyUnicode_Check(a)
#define PY_STRING_AS_STRING(a) PyUnicode_AsUTF8(a)
#define PY_UNICODE_AS_UNICODE(a) PyUnicode_AsUTF8(a)
#define PY_BYTES_FROM_STRING(a) PyBytes_FromString(a)
Expand Down
52 changes: 26 additions & 26 deletions include/pyomodule.h
Original file line number Diff line number Diff line change
Expand Up @@ -679,10 +679,10 @@ extern PyTypeObject MMLZStreamType;
free(self->data); \

#define ASSERT_ARG_NOT_NULL \
if (arg == NULL) { \
Py_INCREF(Py_None); \
return Py_None; \
}
if (arg == NULL) { \
Py_INCREF(Py_None); \
return Py_None; \
}

/* INIT INPUT STREAM */
#define INIT_INPUT_STREAM \
Expand Down Expand Up @@ -1205,28 +1205,28 @@ extern PyTypeObject MMLZStreamType;

/* Normalize */
#define NORMALIZE \
int i; \
MYFLT mi, ma, max, ratio; \
mi = ma = *self->data; \
for (i=1; i<self->size; i++) { \
if (mi > *(self->data+i)) \
mi = *(self->data+i); \
if (ma < *(self->data+i)) \
ma = *(self->data+i); \
} \
if ((mi*mi) > (ma*ma)) \
max = MYFABS(mi); \
else \
max = MYFABS(ma); \
\
if (max > 0.0) { \
ratio = 0.99 / max; \
for (i=0; i<self->size+1; i++) { \
self->data[i] *= ratio; \
} \
} \
Py_INCREF(Py_None); \
return Py_None; \
int i; \
MYFLT mi, ma, max, ratio; \
mi = ma = *self->data; \
for (i=1; i<self->size; i++) { \
if (mi > *(self->data+i)) \
mi = *(self->data+i); \
if (ma < *(self->data+i)) \
ma = *(self->data+i); \
} \
if ((mi*mi) > (ma*ma)) \
max = MYFABS(mi); \
else \
max = MYFABS(ma); \
\
if (max > 0.0) { \
ratio = 0.99 / max; \
for (i=0; i<self->size+1; i++) { \
self->data[i] *= ratio; \
} \
} \
Py_INCREF(Py_None); \
return Py_None; \

#define NORMALIZE_MATRIX \
int i, j; \
Expand Down
16 changes: 10 additions & 6 deletions include/servermodule.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ extern "C" {
#include "sndfile.h"
#include "pyomodule.h"

typedef enum {
typedef enum
{
PyoPortaudio = 0,
PyoCoreaudio = 1,
PyoJack,
Expand All @@ -40,7 +41,8 @@ typedef enum {
PyoEmbedded
} PyoAudioBackendType;

typedef enum {
typedef enum
{
PyoPortmidi = 0,
PyoJackMidi = 1
} PyoMidiBackendType;
Expand All @@ -57,15 +59,17 @@ typedef long PyoMidiTimestamp;
#define PyoMidi_MessageData1(msg) (((msg) >> 8) & 0xFF)
#define PyoMidi_MessageData2(msg) (((msg) >> 16) & 0xFF)

typedef long PyoMidiMessage;
typedef struct {
typedef long PyoMidiMessage;
typedef struct
{
PyoMidiMessage message;
PyoMidiTimestamp timestamp;
} PyoMidiEvent;

/************************************************/

typedef struct {
typedef struct
{
PyObject_HEAD
PyObject *streams;
PyoAudioBackendType audio_be_type;
Expand Down Expand Up @@ -162,7 +166,7 @@ typedef struct {

/* Properties */
int verbosity; /* a sum of values to display different levels: 1 = error */
/* 2 = message, 4 = warning , 8 = debug. Default 7.*/
/* 2 = message, 4 = warning , 8 = debug. Default 7.*/
int globalSeed; /* initial seed for random objects. If <= 0, objects are seeded with the clock. */
int autoStartChildren; /* if true, calls to play, out and stop propagate to children objects. */
} Server;
Expand Down
6 changes: 4 additions & 2 deletions include/streammodule.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
#include <Python.h>
#include "pyomodule.h"

typedef struct {
typedef struct
{
PyObject_HEAD
PyObject *streamobject;
void (*funcptr)();
Expand Down Expand Up @@ -59,7 +60,8 @@ extern PyTypeObject StreamType;
(self)->sid = (self)->chnl = (self)->todac = (self)->bufferCountWait = 0; \
(self)->bufferCount = (self)->bufsize = (self)->duration = (self)->active = 0;

typedef struct {
typedef struct
{
PyObject_HEAD
MYFLT *data;
} TriggerStream;
Expand Down
9 changes: 5 additions & 4 deletions include/tablemodule.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@

#ifdef __TABLE_MODULE

typedef struct {
typedef struct
{
PyObject_HEAD
int size;
double samplingRate;
Expand All @@ -32,9 +33,9 @@ typedef struct {
} TableStream;


#define MAKE_NEW_TABLESTREAM(self, type, rt_error) \
(self) = (TableStream *)(type)->tp_alloc((type), 0); \
if ((self) == rt_error) { return rt_error; } \
#define MAKE_NEW_TABLESTREAM(self, type, rt_error) \
(self) = (TableStream *)(type)->tp_alloc((type), 0); \
if ((self) == rt_error) { return rt_error; } \
\
(self)->size = 0

Expand Down
26 changes: 16 additions & 10 deletions include/vbap.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,41 @@
#ifndef __VBAP_H
#define __VBAP_H

#ifdef __cplusplus
#ifdef __cplusplus
extern "C" {
#endif

#define MAX_LS_AMOUNT 256
#define MAX_TRIPLET_AMOUNT 128
#define MIN_VOL_P_SIDE_LGTH 0.01

typedef struct {
typedef struct
{
int dimension; /* Number of dimension, always 3. */
int count; /* Number of speakers. */
float *azimuth; /* Azimuth angle of speakers. */
float *elevation; /* Elevation angle of speakers. */
} SPEAKERS_SETUP;

/* Cartesian vector for a speaker position. */
typedef struct {
typedef struct
{
float x;
float y;
float z;
} CART_VEC;

/* Angular vector for a speaker position. */
typedef struct {
typedef struct
{
float azi;
float ele;
float length;
} ANG_VEC;

/* A struct for a loudspeaker triplet or pair (set). */
typedef struct {
typedef struct
{
int ls_nos[3];
float inv_mx[9];
float set_gains[3];
Expand All @@ -46,13 +50,15 @@ typedef struct {
} LS_SET;

/* A struct for a loudspeaker instance. */
typedef struct {
typedef struct
{
CART_VEC coords;
ANG_VEC angles;
} ls; // TODO: rename this struct.

/* VBAP structure of n loudspeaker panning */
typedef struct {
typedef struct
{
int out_patches[MAX_LS_AMOUNT]; /* Physical outputs (starts at 1). */
float gains[MAX_LS_AMOUNT]; /* Loudspeaker gains. */
float y[MAX_LS_AMOUNT]; /* Loudspeaker gains smoothing. */
Expand All @@ -75,7 +81,7 @@ SPEAKERS_SETUP * load_speakers_setup(int cnt, float *azi, float *ele);
* File format:
*
* First line starts with an integer which is the number of speakers.
* Remaining lines (must be equal to the number of speakers) starts with
* Remaining lines (must be equal to the number of speakers) starts with
* two floats. They give the azimuth and elevation for each speakers.
*/
SPEAKERS_SETUP * load_speakers_setup_from_file(const char *filename);
Expand All @@ -99,7 +105,7 @@ VBAP_DATA * copy_vbap_data(VBAP_DATA *data);
*/
void free_vbap_data(VBAP_DATA *data);

/* Calculates gain factors using loudspeaker setup and angle direction.
/* Calculates gain factors using loudspeaker setup and angle direction.
*/
void vbap(float azi, float ele, float spread, VBAP_DATA *data);
void vbap2(float azi, float ele, float sp_azi,
Expand All @@ -110,7 +116,7 @@ void vbap2_flip_y_z(float azi, float ele, float sp_azi,

int vbap_get_triplets(VBAP_DATA *data, int ***triplets);

#ifdef __cplusplus
#ifdef __cplusplus
}
#endif

Expand Down
Loading

0 comments on commit 9306151

Please sign in to comment.