Commit 09b3fe71 authored by David Llewellyn-Jones's avatar David Llewellyn-Jones

Bumped version number to 0.36. Updated dpkg configuration files.

parent 4078f308
The MIT License The MIT License
Copyright (c) 2012-2014 David Llewellyn-Jones Copyright (c) 2012-2015 David Llewellyn-Jones
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
......
Functy-0.36: 5-August-2015
- Initial support for function animation using real-time audio frequency analysis
Functy-0.35: 10-May-2015 Functy-0.35: 10-May-2015
- Added config scripts - Added config scripts
......
The MIT License The MIT License
Copyright (c) 2012-2014 David Llewellyn-Jones Copyright (c) 2012-2015 David Llewellyn-Jones
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
......
...@@ -567,6 +567,12 @@ The set of frames is compressed as a zip archive.</property> ...@@ -567,6 +567,12 @@ The set of frames is compressed as a zip archive.</property>
<signal name="activate" handler="gtk_widget_show" swapped="no"/> <signal name="activate" handler="gtk_widget_show" swapped="no"/>
</object> </object>
</child> </child>
<child>
<object class="GtkSeparatorMenuItem" id="separatormenuitem6">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
<child> <child>
<object class="GtkImageMenuItem" id="MenuQuit"> <object class="GtkImageMenuItem" id="MenuQuit">
<property name="label">gtk-quit</property> <property name="label">gtk-quit</property>
......
...@@ -13,6 +13,9 @@ ...@@ -13,6 +13,9 @@
//float DifferentialX (float x, float y, float t); //float DifferentialX (float x, float y, float t);
//float DifferentialY (float x, float y, float t); //float DifferentialY (float x, float y, float t);
//vec4 Colour (float x, float y, float z, float t); //vec4 Colour (float x, float y, float z, float t);
//uniform sampler2D tAudio;
//float audio (float x);
void main () { void main () {
// vec3 vHalf; // vec3 vHalf;
...@@ -68,6 +71,10 @@ void main () { ...@@ -68,6 +71,10 @@ void main () {
gl_FragColor = vec4 (1.0, 1.0, 1.0, 1.0); gl_FragColor = vec4 (1.0, 1.0, 1.0, 1.0);
} }
//float audio (float x) {
// return texture2D (tAudio, vec2(x, 0)).r;
//}
//float DifferentialX (float x, float y, float t) { //float DifferentialX (float x, float y, float t) {
// float z; // float z;
// //
......
...@@ -7,10 +7,12 @@ uniform float fTime; ...@@ -7,10 +7,12 @@ uniform float fTime;
//varying float fDist; //varying float fDist;
varying vec3 vFuncParams; varying vec3 vFuncParams;
//varying mat3 vNormalMatrix; //varying mat3 vNormalMatrix;
uniform sampler2D tAudio;
/*REPLACE:controlvars*//*END*/ /*REPLACE:controlvars*//*END*/
float FunctionZ (float x, float y, float t); float FunctionZ (float x, float y, float t);
float audio (float x);
void main() { void main() {
vec4 vEyeCoordsPos; vec4 vEyeCoordsPos;
...@@ -51,6 +53,10 @@ void main() { ...@@ -51,6 +53,10 @@ void main() {
gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * vVertex; gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * vVertex;
} }
float audio (float x) {
return texture2D (tAudio, vec2(x, 0)).r;
}
float FunctionZ (float x, float y, float t) { float FunctionZ (float x, float y, float t) {
float z; float z;
......
...@@ -12,6 +12,7 @@ varying mat3 mNormalMatrix; ...@@ -12,6 +12,7 @@ varying mat3 mNormalMatrix;
uniform sampler2D tTexture; uniform sampler2D tTexture;
uniform sampler2D tBumpMap; uniform sampler2D tBumpMap;
uniform sampler2DShadow tShadow; uniform sampler2DShadow tShadow;
uniform sampler2D tAudio;
uniform float fBumpScale; uniform float fBumpScale;
uniform float fTextureStrength; uniform float fTextureStrength;
varying vec4 vShadowPos; varying vec4 vShadowPos;
...@@ -25,6 +26,7 @@ uniform float fShadowBlurY; ...@@ -25,6 +26,7 @@ uniform float fShadowBlurY;
float DifferentialX (float x, float y, float t); float DifferentialX (float x, float y, float t);
float DifferentialY (float x, float y, float t); float DifferentialY (float x, float y, float t);
vec4 Colour (float x, float y, float z, float t); vec4 Colour (float x, float y, float z, float t);
float audio (float x);
void main () { void main () {
vec3 vHalf; vec3 vHalf;
...@@ -101,6 +103,10 @@ void main () { ...@@ -101,6 +103,10 @@ void main () {
gl_FragColor.a = vColourRaw.a; gl_FragColor.a = vColourRaw.a;
} }
float audio (float x) {
return texture2D (tAudio, vec2(x, 0)).r;
}
float DifferentialX (float x, float y, float t) { float DifferentialX (float x, float y, float t) {
float z; float z;
......
...@@ -9,12 +9,14 @@ varying vec3 vFuncParams; ...@@ -9,12 +9,14 @@ varying vec3 vFuncParams;
varying mat3 mNormalMatrix; varying mat3 mNormalMatrix;
varying vec4 vShadowPos; varying vec4 vShadowPos;
uniform mat4 mLightTransform; uniform mat4 mLightTransform;
uniform sampler2D tAudio;
#define M_PI (3.1415926535897932384626433832795) #define M_PI (3.1415926535897932384626433832795)
/*REPLACE:controlvars*//*END*/ /*REPLACE:controlvars*//*END*/
float FunctionZ (float x, float y, float t); float FunctionZ (float x, float y, float t);
float audio (float x);
void main() { void main() {
vec4 vEyeCoordsPos; vec4 vEyeCoordsPos;
...@@ -61,6 +63,10 @@ void main() { ...@@ -61,6 +63,10 @@ void main() {
gl_TexCoord[0].t = 0.1f + (vVertex.y) / 2.2f; gl_TexCoord[0].t = 0.1f + (vVertex.y) / 2.2f;
} }
float audio (float x) {
return texture2D (tAudio, vec2(x, 0)).r;
}
float FunctionZ (float x, float y, float t) { float FunctionZ (float x, float y, float t) {
float z; float z;
......
...@@ -9,6 +9,7 @@ uniform float fTime; ...@@ -9,6 +9,7 @@ uniform float fTime;
//varying mat3 vNormalMatrix; //varying mat3 vNormalMatrix;
//varying vec4 vShadowPos; //varying vec4 vShadowPos;
//uniform mat4 mLightTransform; //uniform mat4 mLightTransform;
uniform sampler2D tAudio;
#define M_PI (3.1415926535897932384626433832795) #define M_PI (3.1415926535897932384626433832795)
...@@ -18,6 +19,7 @@ vec3 FunctionC (float a, float t); ...@@ -18,6 +19,7 @@ vec3 FunctionC (float a, float t);
float FunctionR (float a, float p, float t); float FunctionR (float a, float p, float t);
vec3 FunctionD1 (float a, float t); vec3 FunctionD1 (float a, float t);
vec3 FunctionD2 (float a, float t); vec3 FunctionD2 (float a, float t);
float audio (float x);
void main() { void main() {
vec4 vEyeCoordsPos; vec4 vEyeCoordsPos;
...@@ -98,6 +100,10 @@ void main() { ...@@ -98,6 +100,10 @@ void main() {
// gl_TexCoord[0].t = 1.0f * (0.1f + (fP / (M_PI)) / 15.0); // gl_TexCoord[0].t = 1.0f * (0.1f + (fP / (M_PI)) / 15.0);
} }
float audio (float x) {
return texture2D (tAudio, vec2(x, 0)).r;
}
vec3 FunctionC (float a, float t) { vec3 FunctionC (float a, float t) {
vec3 c; vec3 c;
......
...@@ -12,6 +12,7 @@ varying mat3 mNormalMatrix; ...@@ -12,6 +12,7 @@ varying mat3 mNormalMatrix;
uniform sampler2D tTexture; uniform sampler2D tTexture;
uniform sampler2D tBumpMap; uniform sampler2D tBumpMap;
uniform sampler2DShadow tShadow; uniform sampler2DShadow tShadow;
uniform sampler2D tAudio;
uniform float fBumpScale; uniform float fBumpScale;
uniform float fTextureStrength; uniform float fTextureStrength;
varying vec4 vShadowPos; varying vec4 vShadowPos;
...@@ -28,6 +29,7 @@ vec3 FunctionD2 (float a, float t); ...@@ -28,6 +29,7 @@ vec3 FunctionD2 (float a, float t);
float DifferentialA (float a, float p, float t); float DifferentialA (float a, float p, float t);
float DifferentialP (float a, float p, float t); float DifferentialP (float a, float p, float t);
vec4 Colour (float a, float p, float r, float t); vec4 Colour (float a, float p, float r, float t);
float audio (float x);
void main () { void main () {
vec3 vHalf; vec3 vHalf;
...@@ -163,6 +165,10 @@ void main () { ...@@ -163,6 +165,10 @@ void main () {
gl_FragColor.a = vColourRaw.a; gl_FragColor.a = vColourRaw.a;
} }
float audio (float x) {
return texture2D (tAudio, vec2(x, 0)).r;
}
vec4 Colour (float a, float p, float r, float t) { vec4 Colour (float a, float p, float r, float t) {
vec4 c; vec4 c;
......
...@@ -9,6 +9,7 @@ varying vec3 vFuncParams; ...@@ -9,6 +9,7 @@ varying vec3 vFuncParams;
varying mat3 mNormalMatrix; varying mat3 mNormalMatrix;
varying vec4 vShadowPos; varying vec4 vShadowPos;
uniform mat4 mLightTransform; uniform mat4 mLightTransform;
uniform sampler2D tAudio;
#define M_PI (3.1415926535897932384626433832795) #define M_PI (3.1415926535897932384626433832795)
...@@ -18,6 +19,7 @@ vec3 FunctionC (float a, float t); ...@@ -18,6 +19,7 @@ vec3 FunctionC (float a, float t);
float FunctionR (float a, float p, float t); float FunctionR (float a, float p, float t);
vec3 FunctionD1 (float a, float t); vec3 FunctionD1 (float a, float t);
vec3 FunctionD2 (float a, float t); vec3 FunctionD2 (float a, float t);
float audio (float x);
void main() { void main() {
vec4 vEyeCoordsPos; vec4 vEyeCoordsPos;
...@@ -98,6 +100,10 @@ void main() { ...@@ -98,6 +100,10 @@ void main() {
gl_TexCoord[0].t = 1.0f * (0.1f + (fP / (M_PI)) / 15.0); gl_TexCoord[0].t = 1.0f * (0.1f + (fP / (M_PI)) / 15.0);
} }
float audio (float x) {
return texture2D (tAudio, vec2(x, 0)).r;
}
vec3 FunctionC (float a, float t) { vec3 FunctionC (float a, float t) {
vec3 c; vec3 c;
......
...@@ -9,12 +9,14 @@ uniform float fTime; ...@@ -9,12 +9,14 @@ uniform float fTime;
//varying mat3 mNormalMatrix; //varying mat3 mNormalMatrix;
//varying vec4 vShadowPos; //varying vec4 vShadowPos;
//uniform mat4 mLightTransform; //uniform mat4 mLightTransform;
uniform sampler2D tAudio;
#define M_PI (3.1415926535897932384626433832795) #define M_PI (3.1415926535897932384626433832795)
/*REPLACE:controlvars*//*END*/ /*REPLACE:controlvars*//*END*/
float FunctionR (float a, float p, float t); float FunctionR (float a, float p, float t);
float audio (float x);
void main() { void main() {
vec4 vEyeCoordsPos; vec4 vEyeCoordsPos;
...@@ -69,6 +71,10 @@ void main() { ...@@ -69,6 +71,10 @@ void main() {
// gl_TexCoord[0].t = 0.1f + (fP / (M_PI)) / 2.2f; // gl_TexCoord[0].t = 0.1f + (fP / (M_PI)) / 2.2f;
} }
float audio (float x) {
return texture2D (tAudio, vec2(x, 0)).r;
}
float FunctionR (float a, float p, float t) { float FunctionR (float a, float p, float t) {
float r; float r;
......
...@@ -12,6 +12,7 @@ varying mat3 mNormalMatrix; ...@@ -12,6 +12,7 @@ varying mat3 mNormalMatrix;
uniform sampler2D tTexture; uniform sampler2D tTexture;
uniform sampler2D tBumpMap; uniform sampler2D tBumpMap;
uniform sampler2DShadow tShadow; uniform sampler2DShadow tShadow;
uniform sampler2D tAudio;
uniform float fBumpScale; uniform float fBumpScale;
uniform float fTextureStrength; uniform float fTextureStrength;
varying vec4 vShadowPos; varying vec4 vShadowPos;
...@@ -25,6 +26,7 @@ uniform float fShadowBlurY; ...@@ -25,6 +26,7 @@ uniform float fShadowBlurY;
float DifferentialA (float a, float p, float t); float DifferentialA (float a, float p, float t);
float DifferentialP (float a, float p, float t); float DifferentialP (float a, float p, float t);
vec4 Colour (float a, float p, float r, float t); vec4 Colour (float a, float p, float r, float t);
float audio (float x);
void main () { void main () {
vec3 vHalf; vec3 vHalf;
...@@ -119,6 +121,10 @@ void main () { ...@@ -119,6 +121,10 @@ void main () {
gl_FragColor.a = vColourRaw.a; gl_FragColor.a = vColourRaw.a;
} }
float audio (float x) {
return texture2D (tAudio, vec2(x, 0)).r;
}
float DifferentialA (float a, float p, float t) { float DifferentialA (float a, float p, float t) {
float r; float r;
......
...@@ -9,12 +9,14 @@ varying vec3 vFuncParams; ...@@ -9,12 +9,14 @@ varying vec3 vFuncParams;
varying mat3 mNormalMatrix; varying mat3 mNormalMatrix;
varying vec4 vShadowPos; varying vec4 vShadowPos;
uniform mat4 mLightTransform; uniform mat4 mLightTransform;
uniform sampler2D tAudio;
#define M_PI (3.1415926535897932384626433832795) #define M_PI (3.1415926535897932384626433832795)
/*REPLACE:controlvars*//*END*/ /*REPLACE:controlvars*//*END*/
float FunctionR (float a, float p, float t); float FunctionR (float a, float p, float t);
float audio (float x);
void main() { void main() {
vec4 vEyeCoordsPos; vec4 vEyeCoordsPos;
...@@ -69,6 +71,10 @@ void main() { ...@@ -69,6 +71,10 @@ void main() {
gl_TexCoord[0].t = 0.1f + (fP / (M_PI)) / 2.2f; gl_TexCoord[0].t = 0.1f + (fP / (M_PI)) / 2.2f;
} }
float audio (float x) {
return texture2D (tAudio, vec2(x, 0)).r;
}
float FunctionR (float a, float p, float t) { float FunctionR (float a, float p, float t) {
float r; float r;
......
#! /bin/sh #! /bin/sh
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for Functy 0.35. # Generated by GNU Autoconf 2.69 for Functy 0.36.
# #
# Report bugs to <david@flypig.co.uk>. # Report bugs to <david@flypig.co.uk>.
# #
...@@ -580,8 +580,8 @@ MAKEFLAGS= ...@@ -580,8 +580,8 @@ MAKEFLAGS=
# Identity of this package. # Identity of this package.
PACKAGE_NAME='Functy' PACKAGE_NAME='Functy'
PACKAGE_TARNAME='functy' PACKAGE_TARNAME='functy'
PACKAGE_VERSION='0.35' PACKAGE_VERSION='0.36'
PACKAGE_STRING='Functy 0.35' PACKAGE_STRING='Functy 0.36'
PACKAGE_BUGREPORT='david@flypig.co.uk' PACKAGE_BUGREPORT='david@flypig.co.uk'
PACKAGE_URL='' PACKAGE_URL=''
...@@ -1294,7 +1294,7 @@ if test "$ac_init_help" = "long"; then ...@@ -1294,7 +1294,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing. # Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh. # This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF cat <<_ACEOF
\`configure' configures Functy 0.35 to adapt to many kinds of systems. \`configure' configures Functy 0.36 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]... Usage: $0 [OPTION]... [VAR=VALUE]...
...@@ -1360,7 +1360,7 @@ fi ...@@ -1360,7 +1360,7 @@ fi
if test -n "$ac_init_help"; then if test -n "$ac_init_help"; then
case $ac_init_help in case $ac_init_help in
short | recursive ) echo "Configuration of Functy 0.35:";; short | recursive ) echo "Configuration of Functy 0.36:";;
esac esac
cat <<\_ACEOF cat <<\_ACEOF
...@@ -1469,7 +1469,7 @@ fi ...@@ -1469,7 +1469,7 @@ fi
test -n "$ac_init_help" && exit $ac_status test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then if $ac_init_version; then
cat <<\_ACEOF cat <<\_ACEOF
Functy configure 0.35 Functy configure 0.36
generated by GNU Autoconf 2.69 generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc. Copyright (C) 2012 Free Software Foundation, Inc.
...@@ -1930,7 +1930,7 @@ cat >config.log <<_ACEOF ...@@ -1930,7 +1930,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake. running configure, to aid debugging if configure makes a mistake.
It was created by Functy $as_me 0.35, which was It was created by Functy $as_me 0.36, which was
generated by GNU Autoconf 2.69. Invocation command line was generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@ $ $0 $@
...@@ -2793,7 +2793,7 @@ fi ...@@ -2793,7 +2793,7 @@ fi
# Define the identity of the package. # Define the identity of the package.
PACKAGE='functy' PACKAGE='functy'
VERSION='0.35' VERSION='0.36'
cat >>confdefs.h <<_ACEOF cat >>confdefs.h <<_ACEOF
...@@ -6553,7 +6553,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ...@@ -6553,7 +6553,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their # report actual input values of CONFIG_FILES etc. instead of their
# values after options handling. # values after options handling.
ac_log=" ac_log="
This file was extended by Functy $as_me 0.35, which was This file was extended by Functy $as_me 0.36, which was
generated by GNU Autoconf 2.69. Invocation command line was generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES CONFIG_FILES = $CONFIG_FILES
...@@ -6619,7 +6619,7 @@ _ACEOF ...@@ -6619,7 +6619,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\ ac_cs_version="\\
Functy config.status 0.35 Functy config.status 0.36
configured by $0, generated by GNU Autoconf 2.69, configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\" with options \\"\$ac_cs_config\\"
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script. # Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61) AC_PREREQ(2.61)
AC_INIT([Functy], [0.35], [david@flypig.co.uk]) AC_INIT([Functy], [0.36], [david@flypig.co.uk])
AC_CONFIG_AUX_DIR([config]) AC_CONFIG_AUX_DIR([config])
AM_INIT_AUTOMAKE([-Wall -Werror]) AM_INIT_AUTOMAKE([-Wall -Werror])
AC_CONFIG_SRCDIR([src/functy.c]) AC_CONFIG_SRCDIR([src/functy.c])
......
functy (0.36.0-1) unstable; urgency=low
* Initial support for function animation using real-time audio frequency analysis
-- David Llewellyn-Jones <david@flypig.co.uk> Wed, 5 Aug 2015 23:19:30 +0100
functy (0.35.0-1) unstable; urgency=low functy (0.35.0-1) unstable; urgency=low
* Added config scripts * Added config scripts
......
...@@ -2,7 +2,7 @@ Source: functy ...@@ -2,7 +2,7 @@ Source: functy
Section: math Section: math
Priority: extra Priority: extra
Maintainer: David Llewellyn-Jones <david@flypig.co.uk> Maintainer: David Llewellyn-Jones <david@flypig.co.uk>
Build-Depends: debhelper (>= 7), autotools-dev, libgtkglext1-dev, freeglut3-dev, libgtk2.0-dev, libpango1.0-dev, libglib2.0-dev, libcairo2-dev, zlib1g-dev, libzip-dev, libpng12-dev, libtbb-dev, glee-dev, libopenvdb-dev, libopenexr-dev, libsymbolic-dev, libboost-dev Build-Depends: debhelper (>= 7), autotools-dev, libgtkglext1-dev, freeglut3-dev, libgtk2.0-dev, libpango1.0-dev, libglib2.0-dev, libcairo2-dev, zlib1g-dev, libzip-dev, libpng12-dev, libtbb-dev, glee-dev, libopenvdb-dev, libopenexr-dev, libsymbolic-dev, libboost-dev, libpulse-dev, libpulse-mainloop-glib0, fftw3-dev, libncursesw5-dev
Standards-Version: 3.8.0 Standards-Version: 3.8.0
Package: functy Package: functy
......
...@@ -20,8 +20,12 @@ ...@@ -20,8 +20,12 @@
#include <fftw3.h> #include <fftw3.h>
#include <math.h> #include <math.h>
//#include <locale.h> //#define NCURSESBARS (1)
//#include <curses.h>
#ifdef NCURSESBARS
#include <locale.h>
#include <curses.h>
#endif // NCURSESBARS
#include "audio.h" #include "audio.h"
...@@ -32,22 +36,21 @@ ...@@ -32,22 +36,21 @@
#define CHANNELS (1) #define CHANNELS (1)
#define FPS (30) #define FPS (30)
#define GAIN (1.0) #define GAIN (1.0)
#define BARS (120)
#define UPPER_FREQ (3520.0) #define UPPER_FREQ (3520.0)
#define SCALE (78) #define SCALE (78)
#define SOURCE NULL #define SOURCE NULL
#define LATENCY (300000) #define LATENCY (300000)
//#define NCURSESBARS (1)
/////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////
// Structures and enumerations // Structures and enumerations
struct _AudioPersist { struct _AudioPersist {
// General // General
int nBufferSize; int nBufferSize;
int anBars[BARS]; GLubyte auBars[AUDIO_BARS];
int nBufferPos; int nBufferPos;
TexPersist * psTexData;
bool boPause;
// PulseAudio structures // PulseAudio structures
pa_glib_mainloop * psMainLoop; pa_glib_mainloop * psMainLoop;
...@@ -72,7 +75,7 @@ struct _AudioPersist { ...@@ -72,7 +75,7 @@ struct _AudioPersist {
void AudioInitialise (AudioPersist * psAudioData); void AudioInitialise (AudioPersist * psAudioData);
float AudioHanningWindow (int nFrequency, int nMaxFrequency) ; float AudioHanningWindow (int nFrequency, int nMaxFrequency) ;
void CalculateBars (fftw_complex * acFFTData, int nDataSize, int * anBars, int nNumBars); void CalculateBars (fftw_complex * acFFTData, int nDataSize, GLubyte * auBars, int nNumBars);
void PulseAudioStateCallback (pa_context * psContext, void * psUserData); void PulseAudioStateCallback (pa_context * psContext, void * psUserData);
static void PulseAudioStreamReadCallback (pa_stream * psRecordStream, size_t nLength, void * psUserData); static void PulseAudioStreamReadCallback (pa_stream * psRecordStream, size_t nLength, void * psUserData);
void AudioAnalyse (AudioPersist * psAudioData); void AudioAnalyse (AudioPersist * psAudioData);
...@@ -110,9 +113,10 @@ void AudioInitialise (AudioPersist * psAudioData) { ...@@ -110,9 +113,10 @@ void AudioInitialise (AudioPersist * psAudioData) {
psAudioData->pfWindow = g_new (float, psAudioData->nBufferSize); psAudioData->pfWindow = g_new (float, psAudioData->nBufferSize);
psAudioData->pfBuffer = g_new (float, psAudioData->nBufferSize); psAudioData->pfBuffer = g_new (float, psAudioData->nBufferSize);
psAudioData->psRecordStream = NULL; psAudioData->psRecordStream = NULL;
psAudioData->boPause = FALSE;
for (nBar = 0; nBar < BARS; nBar++) { for (nBar = 0; nBar < AUDIO_BARS; nBar++) {
psAudioData->anBars[nBar] = 0; psAudioData->auBars[nBar] = 0;
} }
for (nFrequency = 0; nFrequency < psAudioData->nBufferSize; nFrequency++) { for (nFrequency = 0; nFrequency < psAudioData->nBufferSize; nFrequency++) {
...@@ -143,6 +147,14 @@ void DeleteAudioPersist (AudioPersist * psAudioData) { ...@@ -143,6 +147,14 @@ void DeleteAudioPersist (AudioPersist * psAudioData) {
g_free (psAudioData); g_free (psAudioData);
} }
void SetAudioTextureData (TexPersist * psTexData, AudioPersist * psAudioData) {
psAudioData->psTexData = psTexData;
}
void SetAudioPause (bool boPause, AudioPersist * psAudioData) {
psAudioData->boPause = boPause;
}
float AudioHanningWindow (int nFrequency, int nMaxFrequency) { float AudioHanningWindow (int nFrequency, int nMaxFrequency) {
float fActual; float fActual;
fActual = 0.5f * (1.0f - cosf (2.0f * M_PI * nFrequency / (nMaxFrequency - 1.0f))); fActual = 0.5f * (1.0f - cosf (2.0f * M_PI * nFrequency / (nMaxFrequency - 1.0f)));
...@@ -186,18 +198,21 @@ void RecordStop (AudioPersist * psAudioData) { ...@@ -186,18 +198,21 @@ void RecordStop (AudioPersist * psAudioData) {
psAudioData->psRecordStream = NULL; psAudioData->psRecordStream = NULL;
} }
for (nBar = 0; nBar < BARS; nBar++) { for (nBar = 0; nBar < AUDIO_BARS; nBar++) {
psAudioData->anBars[nBar] = 0; psAudioData->auBars[nBar] = 0;
} }
// Transfer to texture
UpdateTextureSingleChannel (TEXNAME_AUDIO, AUDIO_BARS, 1, psAudioData->auBars, psAudioData->psTexData);
} }
bool AudioCheckRecordActive (AudioPersist * psAudioData) { bool AudioCheckRecordActive (AudioPersist * psAudioData) {
return (psAudioData->psRecordStream != NULL); return (psAudioData->psRecordStream != NULL);
} }
void CalculateBars (fftw_complex * acFFTData, int nDataSize, int * anBars, int nNumBars) { void CalculateBars (fftw_complex * acFFTData, int nDataSize, GLubyte * auBars, int nNumBars) {
// todo: use the float-point value and implement proper interpolation. // todo: use the float-point value and implement proper interpolation.