cleanup when Android is suspending our app.
This commit is contained in:
parent
79089566a1
commit
534c2186f0
|
@ -13,6 +13,7 @@
|
|||
#include <linux/usbdevice_fs.h>
|
||||
#include <asm/byteorder.h>
|
||||
|
||||
extern int is_suspended;
|
||||
|
||||
#define MAX_LEDS_PER_NOTE 512
|
||||
|
||||
|
@ -43,10 +44,13 @@ static void DTAUpdate(void * id, struct NoteFinder*nf)
|
|||
RequestPermissionOrGetConnectionFD( TensigralDebugStatus, 0xabcd, 0xf410 );
|
||||
}
|
||||
|
||||
if( !is_suspended )
|
||||
{
|
||||
CNFGPenX = 800;
|
||||
CNFGPenY = 800;
|
||||
CNFGColor( 0xffffff );
|
||||
CNFGDrawText( TensigralDebugStatus, 2 );
|
||||
}
|
||||
|
||||
if( !deviceConnectionFD ) return;
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ void HandleDestroy()
|
|||
|
||||
#endif
|
||||
|
||||
|
||||
int is_suspended = 0;
|
||||
|
||||
float DeltaFrameTime = 0;
|
||||
double Now = 0;
|
||||
|
@ -290,12 +290,12 @@ void SoundCB( struct CNFADriver * sd, short * in, short * out, int samplesr, int
|
|||
#ifdef ANDROID
|
||||
void HandleSuspend()
|
||||
{
|
||||
//Unused.
|
||||
is_suspended = 1;
|
||||
}
|
||||
|
||||
void HandleResume()
|
||||
{
|
||||
//Unused.
|
||||
is_suspended = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -488,7 +488,7 @@ int main(int argc, char ** argv)
|
|||
//int maxdists = freqbins/2;
|
||||
|
||||
//Do a bunch of debugging.
|
||||
if( show_debug_basic )
|
||||
if( show_debug_basic && !is_suspended )
|
||||
{
|
||||
//char sttdebug[1024];
|
||||
//char * sttend = sttdebug;
|
||||
|
@ -544,7 +544,7 @@ int main(int argc, char ** argv)
|
|||
}
|
||||
|
||||
//Extra debugging?
|
||||
if( show_debug )
|
||||
if( show_debug && !is_suspended )
|
||||
{
|
||||
//Draw the histogram
|
||||
float lasthistval;
|
||||
|
@ -583,6 +583,8 @@ int main(int argc, char ** argv)
|
|||
CNFGDrawText( stdebug, 2 );
|
||||
}
|
||||
|
||||
if( !is_suspended )
|
||||
{
|
||||
CNFGColor( show_debug?0xffffff:0x000000 );
|
||||
CNFGPenX = 0; CNFGPenY = screeny-10;
|
||||
CNFGDrawText( "Extra Debug (D)", 2 );
|
||||
|
@ -606,9 +608,9 @@ int main(int argc, char ** argv)
|
|||
CNFGPenX = 10; CNFGPenY = 600;
|
||||
CNFGDrawText( genlog, 3 );
|
||||
#endif
|
||||
|
||||
CNFGSwapBuffers();
|
||||
}
|
||||
}
|
||||
|
||||
//Finish Rawdraw with FPS counter, and a nice delay loop.
|
||||
frames++;
|
||||
|
|
Loading…
Reference in a new issue