new shot at androidbase
This commit is contained in:
parent
26bcc970fa
commit
abca7b6407
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -1,3 +1,6 @@
|
||||||
[submodule "embedded8266/esp82xx"]
|
[submodule "embedded8266/esp82xx"]
|
||||||
path = embedded8266/esp82xx
|
path = embedded8266/esp82xx
|
||||||
url = https://github.com/cnlohr/esp82xx.git
|
url = https://github.com/cnlohr/esp82xx.git
|
||||||
|
[submodule "colorchord2/rawdraw"]
|
||||||
|
path = colorchord2/rawdraw
|
||||||
|
url = https://github.com/cntools/rawdraw
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "parameters.h"
|
#include "parameters.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "color.h"
|
#include "color.h"
|
||||||
|
|
|
@ -62,7 +62,50 @@ void SetEnvValues( int force )
|
||||||
if( !hits && !force ) return;
|
if( !hits && !force ) return;
|
||||||
|
|
||||||
//Otherwise, something changed.
|
//Otherwise, something changed.
|
||||||
|
#ifdef ANDROID
|
||||||
|
SetParametersFromString( "cpu_autolimit=1" );
|
||||||
|
SetParametersFromString( "set_screenx=720" );
|
||||||
|
SetParametersFromString( "set_screeny=480" );
|
||||||
|
SetParametersFromString( "buffer=384" );
|
||||||
|
SetParametersFromString( "play=0" );
|
||||||
|
SetParametersFromString( "rec=1" );
|
||||||
|
SetParametersFromString( "channels=2" );
|
||||||
|
SetParametersFromString( "samplerate=44100" );
|
||||||
|
SetParametersFromString( "sourcename=default" );
|
||||||
|
SetParametersFromString( "amplify=2.0" );
|
||||||
|
SetParametersFromString( "base_hz=55" );
|
||||||
|
|
||||||
|
SetParametersFromString( "dft_iir=0.6" );
|
||||||
|
SetParametersFromString( "dft_q=20.0000" );
|
||||||
|
SetParametersFromString( "dft_speedup=1000.0000" );
|
||||||
|
SetParametersFromString( "octaves=5" );
|
||||||
|
|
||||||
|
SetParametersFromString( "do_progressive_dft=4" );
|
||||||
|
|
||||||
|
SetParametersFromString( "filter_iter=2" );
|
||||||
|
SetParametersFromString( "filter_strength=.5" );
|
||||||
|
SetParametersFromString( "freqbins = 24" );
|
||||||
|
SetParametersFromString( "do_progressive_dft=4" );
|
||||||
|
SetParametersFromString( "note_attach_amp_iir=0.3500" );
|
||||||
|
SetParametersFromString( "note_attach_amp_iir2=0.250" );
|
||||||
|
|
||||||
|
SetParametersFromString( "note_combine_distance=0.5000" );
|
||||||
|
SetParametersFromString( "note_jumpability=1.8000" );
|
||||||
|
SetParametersFromString( "note_minimum_new_distribution_value=0.0200" );
|
||||||
|
SetParametersFromString( "note_out_chop=0.05000" );
|
||||||
|
SetParametersFromString( "outdrivers=OutputVoronoi,DisplayArray" );
|
||||||
|
SetParametersFromString( "note_attach_amp_iir2=0.250" );
|
||||||
|
|
||||||
|
SetParametersFromString( "lightx=64" );
|
||||||
|
SetParametersFromString( "lighty=32" );
|
||||||
|
SetParametersFromString( "fromsides=1" );
|
||||||
|
SetParametersFromString( "shape_cutoff=0.03" );
|
||||||
|
|
||||||
|
SetParametersFromString( "satamp=5.000" );
|
||||||
|
SetParametersFromString( "amppow=2.510" );
|
||||||
|
SetParametersFromString( "distpow=1.500" );
|
||||||
|
|
||||||
|
#else
|
||||||
LoadFile( InitialFile[0] );
|
LoadFile( InitialFile[0] );
|
||||||
|
|
||||||
for( i = 1; i < gargc; i++ )
|
for( i = 1; i < gargc; i++ )
|
||||||
|
@ -78,6 +121,7 @@ void SetEnvValues( int force )
|
||||||
LoadFile( gargv[i] );
|
LoadFile( gargv[i] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProcessArgs()
|
void ProcessArgs()
|
||||||
|
|
|
@ -18,6 +18,36 @@
|
||||||
#include "hook.h"
|
#include "hook.h"
|
||||||
#include "configs.h"
|
#include "configs.h"
|
||||||
|
|
||||||
|
#ifdef ANDROID
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <android/log.h>
|
||||||
|
#include <pthread.h>
|
||||||
|
|
||||||
|
static int pfd[2];
|
||||||
|
static pthread_t loggingThread;
|
||||||
|
static const char *LOG_TAG = "colorchord";
|
||||||
|
static void *loggingFunction(void*v) {
|
||||||
|
ssize_t readSize;
|
||||||
|
char buf[128];
|
||||||
|
|
||||||
|
while((readSize = read(pfd[0], buf, sizeof buf - 1)) > 0) {
|
||||||
|
if(buf[readSize - 1] == '\n') {
|
||||||
|
--readSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
buf[readSize] = 0; // add null-terminator
|
||||||
|
|
||||||
|
__android_log_write(ANDROID_LOG_DEBUG, LOG_TAG, buf); // Set any log level you want
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
struct SoundDriver * sd;
|
struct SoundDriver * sd;
|
||||||
|
|
||||||
#if defined(WIN32) || defined(USE_WINDOWS)
|
#if defined(WIN32) || defined(USE_WINDOWS)
|
||||||
|
@ -162,9 +192,40 @@ void SoundCB( float * out, float * in, int samplesr, int * samplesp, struct Soun
|
||||||
*samplesp = samplesr;
|
*samplesp = samplesr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ANDROID
|
||||||
|
void HandleSuspend()
|
||||||
|
{
|
||||||
|
//Unused.
|
||||||
|
}
|
||||||
|
|
||||||
|
void HandleResume()
|
||||||
|
{
|
||||||
|
//Unused.
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int main(int argc, char ** argv)
|
int main(int argc, char ** argv)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
#ifdef ANDROID
|
||||||
|
setvbuf(stdout, 0, _IOLBF, 0); // make stdout line-buffered
|
||||||
|
setvbuf(stderr, 0, _IONBF, 0); // make stderr unbuffered
|
||||||
|
|
||||||
|
/* create the pipe and redirect stdout and stderr */
|
||||||
|
pipe(pfd);
|
||||||
|
dup2(pfd[1], 1);
|
||||||
|
dup2(pfd[1], 2);
|
||||||
|
|
||||||
|
/* spawn the logging thread */
|
||||||
|
if(pthread_create(&loggingThread, 0, loggingFunction, 0) == -1) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
pthread_detach(loggingThread);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef TCC
|
#ifdef TCC
|
||||||
void ManuallyRegisterDevices();
|
void ManuallyRegisterDevices();
|
||||||
ManuallyRegisterDevices();
|
ManuallyRegisterDevices();
|
||||||
|
@ -181,6 +242,8 @@ int main(int argc, char ** argv)
|
||||||
WSAStartup(0x202, &wsaData);
|
WSAStartup(0x202, &wsaData);
|
||||||
|
|
||||||
strcpy( sound_source, "WIN" );
|
strcpy( sound_source, "WIN" );
|
||||||
|
#elif defined( ANDROID )
|
||||||
|
strcpy( sound_source, "ANDROID" );
|
||||||
#else
|
#else
|
||||||
strcpy( sound_source, "PULSE" );
|
strcpy( sound_source, "PULSE" );
|
||||||
#endif
|
#endif
|
||||||
|
@ -263,6 +326,7 @@ int main(int argc, char ** argv)
|
||||||
double Last = Now;
|
double Last = Now;
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
|
printf( ".\n" );
|
||||||
char stt[1024];
|
char stt[1024];
|
||||||
//Handle Rawdraw frame swappign
|
//Handle Rawdraw frame swappign
|
||||||
|
|
||||||
|
|
|
@ -228,7 +228,12 @@ void OGCancelThread( og_thread_t ot )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#ifdef ANDROID
|
||||||
|
void * fakeret;
|
||||||
|
pthread_join( *(pthread_t*)ot, &fakeret );
|
||||||
|
#else
|
||||||
pthread_cancel( *(pthread_t*)ot );
|
pthread_cancel( *(pthread_t*)ot );
|
||||||
|
#endif
|
||||||
free( ot );
|
free( ot );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
|
|
||||||
This is a vornoi thing:
|
This is a vornoi thing:
|
||||||
outdrivers = DisplayArray, OutputProminent
|
outdrivers = DisplayArray, OutputCells
|
||||||
lightx = 2
|
lightx = 3
|
||||||
lighty = 2
|
lighty = 3
|
||||||
leds = 4
|
leds = 9
|
||||||
fromsides = 1
|
fromsides = 0
|
||||||
shape_cutoff = 0.03
|
shape_cutoff = 0.03
|
||||||
satamp = 5.000
|
satamp = 5.000
|
||||||
amppow = 2.510
|
amppow = 2.510
|
||||||
|
@ -13,7 +13,8 @@ distpow = 1.500
|
||||||
samplerate = 11025
|
samplerate = 11025
|
||||||
buffer = 64
|
buffer = 64
|
||||||
|
|
||||||
sourcename = default
|
sourcename = alsa_output.pci-0000_00_1f.3.analog-stereo.monitor
|
||||||
|
#default
|
||||||
|
|
||||||
amplify = 2.5
|
amplify = 2.5
|
||||||
note_attach_amp_iir = 0.9000
|
note_attach_amp_iir = 0.9000
|
||||||
|
|
1
colorchord2/rawdraw
Submodule
1
colorchord2/rawdraw
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit e5acb751f337f3ae9e558e98907be8e3d6f8381f
|
|
@ -4,6 +4,7 @@
|
||||||
#include "os_generic.h"
|
#include "os_generic.h"
|
||||||
#include "parameters.h"
|
#include "parameters.h"
|
||||||
#include <alsa/asoundlib.h>
|
#include <alsa/asoundlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#define BUFFERSETS 4
|
#define BUFFERSETS 4
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue