Skip to content

Commit 951ecbe

Browse files
committed
fix some tracing bugs
1 parent 4481af8 commit 951ecbe

13 files changed

+117
-104
lines changed

configure

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#! /bin/sh
22
# Guess values for system-dependent variables and create Makefiles.
3-
# Generated by GNU Autoconf 2.69 for loopidity 0.14.007.
3+
# Generated by GNU Autoconf 2.69 for loopidity 0.14.008.
44
#
55
# Report bugs to <https://github.com/bill-auger/loopidity/issues>.
66
#
@@ -580,8 +580,8 @@ MAKEFLAGS=
580580
# Identity of this package.
581581
PACKAGE_NAME='loopidity'
582582
PACKAGE_TARNAME='loopidity'
583-
PACKAGE_VERSION='0.14.007'
584-
PACKAGE_STRING='loopidity 0.14.007'
583+
PACKAGE_VERSION='0.14.008'
584+
PACKAGE_STRING='loopidity 0.14.008'
585585
PACKAGE_BUGREPORT='https://github.com/bill-auger/loopidity/issues'
586586
PACKAGE_URL=''
587587

@@ -1308,7 +1308,7 @@ if test "$ac_init_help" = "long"; then
13081308
# Omit some internal or obsolete options to make the list less imposing.
13091309
# This message is too long to be a string in the A/UX 3.1 sh.
13101310
cat <<_ACEOF
1311-
\`configure' configures loopidity 0.14.007 to adapt to many kinds of systems.
1311+
\`configure' configures loopidity 0.14.008 to adapt to many kinds of systems.
13121312
13131313
Usage: $0 [OPTION]... [VAR=VALUE]...
13141314
@@ -1379,7 +1379,7 @@ fi
13791379

13801380
if test -n "$ac_init_help"; then
13811381
case $ac_init_help in
1382-
short | recursive ) echo "Configuration of loopidity 0.14.007:";;
1382+
short | recursive ) echo "Configuration of loopidity 0.14.008:";;
13831383
esac
13841384
cat <<\_ACEOF
13851385
@@ -1489,7 +1489,7 @@ fi
14891489
test -n "$ac_init_help" && exit $ac_status
14901490
if $ac_init_version; then
14911491
cat <<\_ACEOF
1492-
loopidity configure 0.14.007
1492+
loopidity configure 0.14.008
14931493
generated by GNU Autoconf 2.69
14941494
14951495
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1950,7 +1950,7 @@ cat >config.log <<_ACEOF
19501950
This file contains any messages produced by compilers while
19511951
running configure, to aid debugging if configure makes a mistake.
19521952
1953-
It was created by loopidity $as_me 0.14.007, which was
1953+
It was created by loopidity $as_me 0.14.008, which was
19541954
generated by GNU Autoconf 2.69. Invocation command line was
19551955
19561956
$ $0 $@
@@ -2814,7 +2814,7 @@ fi
28142814

28152815
# Define the identity of the package.
28162816
PACKAGE='loopidity'
2817-
VERSION='0.14.007'
2817+
VERSION='0.14.008'
28182818

28192819

28202820
cat >>confdefs.h <<_ACEOF
@@ -9130,7 +9130,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
91309130
# report actual input values of CONFIG_FILES etc. instead of their
91319131
# values after options handling.
91329132
ac_log="
9133-
This file was extended by loopidity $as_me 0.14.007, which was
9133+
This file was extended by loopidity $as_me 0.14.008, which was
91349134
generated by GNU Autoconf 2.69. Invocation command line was
91359135
91369136
CONFIG_FILES = $CONFIG_FILES
@@ -9187,7 +9187,7 @@ _ACEOF
91879187
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
91889188
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
91899189
ac_cs_version="\\
9190-
loopidity config.status 0.14.007
9190+
loopidity config.status 0.14.008
91919191
configured by $0, generated by GNU Autoconf 2.69,
91929192
with options \\"\$ac_cs_config\\"
91939193

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Process this file with autoconf to produce a configure script.
33

44
AC_PREREQ([2.69])
5-
AC_INIT([loopidity], [0.14.007], [https://github.com/bill-auger/loopidity/issues])
5+
AC_INIT([loopidity], [0.14.008], [https://github.com/bill-auger/loopidity/issues])
66
AC_CONFIG_SRCDIR([src/loopidity.cpp])
77
AM_INIT_AUTOMAKE([subdir-objects foreign -Wall -Werror])
88
AC_CONFIG_FILES([Makefile])

src/constants/controller_constants.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,15 @@
4949
#define JACK_INPUT4_PORT_NAME "in4"
5050
#define JACK_OUTPUT1_PORT_NAME "outL"
5151
#define JACK_OUTPUT2_PORT_NAME "outR"
52+
#define LOOPIDITY_REINIT_MSG "ERROR: Loopidity::Main() and Loopidity::Init() should be called only once"
53+
#define N_SCENES_ERR_MSG "ERROR: N_SCENES out of range - quitting"
5254
#define INVALID_METADATA_MSG "ERROR: Scene metadata state insane"
55+
#define LOOPIDITY_INIT_FAIL_MSG "ERROR: Could not initialize Loopidity"
56+
#define JACK_INIT_FAIL_MSG "ERROR: Could not initialize JACK"
5357
//#define FREEMEM_FAIL_MSG "ERROR: Could not determine available memory - quitting"
54-
#define INSUFFICIENT_MEMORY_MSG "ERROR: Insufficient memory initializng buffers"
55-
#define JACK_SW_FAIL_MSG "ERROR: Could not register JACK client"
56-
#define JACK_HW_FAIL_MSG "ERROR: Could not open ports for JACK"
58+
#define INSUFFICIENT_MEMORY_MSG "ERROR: Insufficient memory initializng buffers - quitting"
59+
#define JACK_SW_FAIL_MSG "ERROR: Could not register JACK client - quitting"
60+
#define JACK_HW_FAIL_MSG "ERROR: Could not open ports for JACK - quitting"
5761
#define OUT_OF_MEMORY_MSG "ERROR: Out of Memory"
5862

5963
// sdl user events

src/constants/feature_constants.h

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -45,23 +45,15 @@
4545
# define DRAW_CURRENT_SCENE_INDICATOR 1
4646
#endif // #if DRAW_SCENES
4747

48-
#if DRAW_DEBUG_TEXT
49-
# include "../trace/trace.h"
50-
# define DRAW_DEBUG_TEXT_L Trace::SetDbgTextC() ;
51-
# define DRAW_DEBUG_TEXT_R Trace::SetDbgTextR() ;
52-
#else
53-
# define DRAW_DEBUG_TEXT_L ;
54-
# define DRAW_DEBUG_TEXT_R ;
55-
#endif // #if DRAW_DEBUG_TEXT
56-
5748
// Trace class features
5849
#define DEBUG_TRACE 1
59-
#define DEBUG_TRACE_JACK DEBUG_TRACE && 0
60-
#define DEBUG_TRACE_LOOPIDITY DEBUG_TRACE && 0
61-
#define DEBUG_TRACE_LOOPIDITYSDL DEBUG_TRACE && 0
62-
#define DEBUG_TRACE_SCENE DEBUG_TRACE && 0
63-
#define DEBUG_TRACE_SCENESDL DEBUG_TRACE && 0
64-
#define DEBUG_TRACE_CLASS DEBUG_TRACE && 0
65-
#define DEBUG_TRACE_EVS DEBUG_TRACE && 1
66-
#define DEBUG_TRACE_IN DEBUG_TRACE && 1
67-
#define DEBUG_TRACE_OUT DEBUG_TRACE && 1
50+
#define DEBUG_TRACE_ALL 1
51+
#define DEBUG_TRACE_JACK DEBUG_TRACE && (DEBUG_TRACE_ALL || 0)
52+
#define DEBUG_TRACE_LOOPIDITY DEBUG_TRACE && (DEBUG_TRACE_ALL || 0)
53+
#define DEBUG_TRACE_LOOPIDITYSDL DEBUG_TRACE && (DEBUG_TRACE_ALL || 0)
54+
#define DEBUG_TRACE_SCENE DEBUG_TRACE && (DEBUG_TRACE_ALL || 0)
55+
#define DEBUG_TRACE_SCENESDL DEBUG_TRACE && (DEBUG_TRACE_ALL || 0)
56+
#define DEBUG_TRACE_CLASS DEBUG_TRACE && (DEBUG_TRACE_ALL || 0)
57+
#define DEBUG_TRACE_EVS DEBUG_TRACE && (DEBUG_TRACE_ALL || 1)
58+
#define DEBUG_TRACE_IN DEBUG_TRACE && (DEBUG_TRACE_ALL || 1)
59+
#define DEBUG_TRACE_OUT DEBUG_TRACE && (DEBUG_TRACE_ALL || 1)

src/constants/view_constants.h

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@
88
#define GUI_UPDATE_LOW_PRIORITY_NICE 8 // n high priority updates to pass
99

1010
// window magnitudes
11-
#define SCREEN_W 1024 // minimum screen resolution
12-
#define SCREEN_H 768 // minimum screen resolution
13-
#define WIN_TITLE_H 20 // approximate window decoration size
14-
#define WIN_BORDER_W 2 // approximate window decoration size
15-
#define WIN_BORDER_H 2 // approximate window decoration size
16-
#define PIXEL_DEPTH 32
17-
#define WIN_W (SCREEN_W - (WIN_BORDER_W * 2))
18-
#define WIN_H (SCREEN_H - WIN_TITLE_H - WIN_BORDER_H)
19-
#define WIN_RECT { 0 , 0 , WIN_W , WIN_H }
20-
#define WIN_CENTER (WinRect.w / 2)
11+
#define SCREEN_W_MIN 1024 // minimum screen resolution
12+
#define SCREEN_H_MIN 768 // minimum screen resolution
13+
#define WIN_TITLE_H 20 // approximate window decoration size
14+
#define WIN_BORDER_W 2 // approximate window decoration size
15+
#define WIN_BORDER_H 2 // approximate window decoration size
16+
#define BITS_PER_PIXEL 32
17+
#define WIN_W (SCREEN_W_MIN - (WIN_BORDER_W * 2))
18+
#define WIN_H (SCREEN_H_MIN - WIN_TITLE_H - WIN_BORDER_H)
19+
#define WIN_RECT { 0 , 0 , WIN_W , WIN_H }
20+
#define WIN_CENTER (WinRect.w / 2)
2121

2222
// header magnitudes
2323
#define HEADER_FONT_SIZE 36
@@ -94,18 +94,13 @@
9494
# define EDIT_HISTOGRAM_GRADUATION_H 12
9595
#endif // #if SCENE_NFRAMES_EDITABLE
9696

97-
// external assets
98-
#define SCOPE_IMG_PATH "scope_gradient.bmp"
99-
#define HISTOGRAM_IMG_PATH "histogram_gradient.bmp"
100-
#define LOOP_IMG_PATH "loop_gradient.argb.bmp"
101-
#define PURISA_TTF_PATH "Purisa.ttf"
102-
10397
// fonts and colors
104-
#define HEADER_FONT_PATH PURISA_TTF_PATH
98+
#define PURISA_TTF "Purisa.ttf"
99+
#define HEADER_FONT PURISA_TTF
105100
#define HEADER_TEXT_COLOR { 255 , 0 , 255 , 0 }
106-
#define STATUS_FONT_PATH PURISA_TTF_PATH
101+
#define STATUS_FONT PURISA_TTF
107102
#define STATUS_TEXT_COLOR { 255 , 0 , 255 , 0 }
108-
#define WINDOWBGCOLOR 0xFF111111
103+
#define WINDOWBGCOLOR 0xFF333333
109104
#define VUSINBGCOLOR 0xFF221122
110105
#define VUSOUTBGCOLOR 0xFF112222 // NOTE: SDL_FillRect() takes 0xAARRGGBB
111106
#define VUSINBORDERCOLOR 0x882288FF // NOTE: roundedRectangleColor() takes 0xRRGGBBAA
@@ -119,8 +114,11 @@
119114

120115
// string constants
121116
#define HEADER_TEXT "This is Loopidity"
122-
#define X11_ERROR_MSG "ERROR: LoopiditySdl::Init(): XGetWindowAttributes(): can't get root window geometry - quitting\n"
123-
#define RESOLUTION_ERROR_MSG "ERROR: screen resolution must be at least %dx%d - quitting\n"
117+
#define LOOPIDITYSDL_REINIT_MSG "ERROR: LoopiditySdl::Init() should be called only once"
118+
#define LOOPIDITYSDL_INIT_FAIL_MSG "ERROR: Data model not prepared before initializing GUI"
119+
#define X11_ERROR_MSG "ERROR: Could not get root window geometry - quitting"
120+
#define RESOLUTION_ERROR_MSG "ERROR: Screen resolution must be at least " + \
121+
std::to_string(SCREEN_MIN_W) + "x" + std::to_string(SCREEN_MIN_H) + " - quitting"
124122
#define SDL_ERROR_FMT "ERROR: %s(): %s\n"
125123
#define SDL_INIT_ERROR_TEXT "SDL_Init"
126124
#define SDL_SETVIDEOMODE_ERROR_TEXT "SDL_SetVideoMode"

src/loopidity.cpp

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ int Loopidity::Main(int argc , char** argv)
6969
{
7070
// sanity checks
7171
#if INIT_JACK_BEFORE_SCENES
72-
if (IsInitialized ) return false ;
72+
if (IsInitialized ) { LoopiditySdl::Alert(LOOPIDITY_REINIT_MSG) ; return EXIT_FAILURE ; }
7373
#else // INIT_JACK_BEFORE_SCENES
74-
if (IsInitialized() ) return false ;
74+
if (IsInitialized() ) { LoopiditySdl::Alert(LOOPIDITY_REINIT_MSG) ; return EXIT_FAILURE ; }
7575
#endif // INIT_JACK_BEFORE_SCENES
76-
if (N_SCENES + 2 < N_SCENES) return false ;
76+
if (N_SCENES + 2 < N_SCENES) { LoopiditySdl::Alert(N_SCENES_ERR_MSG ) ; return EXIT_FAILURE ; }
7777

7878
// parse command line arguments
7979
bool shouldMonitorInputs = true ;
@@ -92,7 +92,7 @@ int Loopidity::Main(int argc , char** argv)
9292
// initialize Loopidity (controller), JackIO (controller), and LoopiditySdl (main view)
9393
// and instantiate Scenes (models) and SdlScenes (views)
9494
if (!Init(shouldMonitorInputs , shouldAutoSceneChange , recordBufferSize))
95-
return Cleanup(EXIT_FAILURE) ;
95+
{ Cleanup(LOOPIDITY_INIT_FAIL_MSG) ; return EXIT_FAILURE ; }
9696

9797
DEBUG_TRACE_LOOPIDITY_MAIN_MID
9898

@@ -154,7 +154,7 @@ if (guiLongCount == GUI_UPDATE_LOW_PRIORITY_NICE)
154154

155155
DEBUG_TRACE_LOOPIDITY_MAIN_OUT
156156

157-
return Cleanup(EXIT_SUCCESS) ;
157+
Cleanup() ; return EXIT_SUCCESS ;
158158
}
159159

160160

@@ -196,6 +196,13 @@ bool Loopidity::IsInitialized() { return !!Scenes[0] ; }
196196
bool Loopidity::Init(bool shouldMonitorInputs , bool shouldAutoSceneChange ,
197197
Uint32 recordBufferSize )
198198
{
199+
// sanity checks
200+
#if INIT_JACK_BEFORE_SCENES
201+
if (IsInitialized) { LoopiditySdl::Alert(LOOPIDITY_REINIT_MSG) ; return EXIT_FAILURE ; }
202+
#else // INIT_JACK_BEFORE_SCENES
203+
if (IsInitialized()) { LoopiditySdl::Alert(LOOPIDITY_REINIT_MSG) ; return EXIT_FAILURE ; }
204+
#endif // INIT_JACK_BEFORE_SCENES
205+
199206
// disable AutoSceneChange if SCENE_CHANGE_ARG given
200207
if (!shouldAutoSceneChange) ToggleAutoSceneChange() ;
201208

@@ -211,9 +218,9 @@ bool Loopidity::Init(bool shouldMonitorInputs , bool shouldAutoSceneChange ,
211218
}
212219

213220
# if WAIT_FOR_JACK_INIT
214-
// wait for JACK metadata
221+
// wait for JACK metadata via SetMetadata()
215222
while (!IsJackReady && (InitJackTimeout -= 100) > 0) usleep(100000) ;
216-
if (!IsJackReady) return false ; // via SetMetadata()
223+
if (!IsJackReady) { LoopiditySdl::Alert(JACK_INIT_FAIL_MSG) ; return false ; }
217224
# endif // WAIT_FOR_JACK_INIT
218225
#endif // INIT_JACK_BEFORE_SCENES
219226

@@ -252,25 +259,17 @@ bool Loopidity::Init(bool shouldMonitorInputs , bool shouldAutoSceneChange ,
252259
default: break ;
253260
}
254261
# if WAIT_FOR_JACK_INIT
255-
// wait for JACK metadata
262+
// wait for JACK metadata via SetMetadata()
256263
while (!IsJackReady && (InitJackTimeout -= 100) > 0) usleep(100000) ;
257-
if (!IsJackReady) return false ; // via SetMetadata()
264+
if (!IsJackReady) { LoopiditySdl::Alert(JACK_INIT_FAIL_MSG) ; return false ; }
258265
# endif // WAIT_FOR_JACK_INIT
259266
#endif // INIT_JACK_BEFORE_SCENES
260267

261268
// initialize LoopiditySdl (view)
262269
#if INIT_JACK_BEFORE_SCENES
263-
IsInitialized = LoopiditySdl::Init(SdlScenes , peaksIn , peaksOut , peaksVuIn , peaksVuOut) ;
264-
265-
if (!IsInitialized) Cleanup(EXIT_FAILURE) ;
266-
267-
return IsInitialized ;
270+
return (IsInitialized = LoopiditySdl::Init(SdlScenes , peaksIn , peaksOut , peaksVuIn , peaksVuOut)) ;
268271
#else // INIT_JACK_BEFORE_SCENES
269-
bool is_initialized = LoopiditySdl::Init(SdlScenes , peaksIn , peaksOut , peaksVuIn , peaksVuOut) ;
270-
271-
if (!is_initialized) Cleanup(EXIT_FAILURE) ;
272-
273-
return is_initialized ;
272+
return LoopiditySdl::Init(SdlScenes , peaksIn , peaksOut , peaksVuIn , peaksVuOut) ;
274273
#endif // INIT_JACK_BEFORE_SCENES
275274
}
276275

@@ -306,15 +305,15 @@ void Loopidity::SetMetadata(Uint32 sampleRate , Uint32 nFramesPerPeriod)
306305
# endif // #if SCENE_NFRAMES_EDITABLE
307306
#endif // #if INIT_JACK_BEFORE_SCENES
308307

309-
int Loopidity::Cleanup(int exit_status)
308+
void Loopidity::Cleanup(std::string status_msg)
310309
{
311-
DEBUG_TRACE_LOOPIDITY_CLEANUP
310+
DEBUG_TRACE_LOOPIDITY_CLEANUP
311+
312+
if (!status_msg.empty()) LoopiditySdl::Alert(status_msg) ;
312313

313314
for (Uint32 sceneN = 0 ; sceneN < N_SCENES ; ++sceneN)
314315
if (!!SdlScenes[sceneN]) SdlScenes[sceneN]->cleanup() ;
315316
LoopiditySdl::Cleanup() ;
316-
317-
return exit_status ;
318317
}
319318

320319

@@ -497,11 +496,11 @@ DEBUG_TRACE_LOOPIDITY_RESETSCENE_IN
497496
Scenes[sceneN]->reset() ; SdlScenes[sceneN]->reset() ; UpdateView(sceneN) ;
498497

499498
bool doesAnyPulseExist = false ;
500-
for (sceneN = 0 ; sceneN < N_SCENES ; ++sceneN)
499+
for (int scene_n = 0 ; scene_n < N_SCENES ; ++scene_n)
501500
{
502-
doesAnyPulseExist |= Scenes[sceneN]->getDoesPulseExist() ;
501+
doesAnyPulseExist |= Scenes[scene_n]->getDoesPulseExist() ;
503502
// TODO: extract this into doesAnyPulseExist()
504-
//DBG("Loopidity::ResetScene() Scenes[%d]->getDoesPulseExist()=%d doesAnyPulseExist=%d\n" , sceneN , Scenes[sceneN]->getDoesPulseExist() , doesAnyPulseExist) ;
503+
//DBG("Loopidity::ResetScene() Scenes[%d]->getDoesPulseExist()=%d doesAnyPulseExist=%d\n" , scene_n , Scenes[scene_n]->getDoesPulseExist() , doesAnyPulseExist) ;
505504
}
506505
IsRolling = doesAnyPulseExist ;
507506

src/loopidity.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ class Loopidity
131131
#else
132132
static void SetMetadata( Uint32 sampleRate , Uint32 nFramesPerPeriod) ;
133133
#endif // #if INIT_JACK_BEFORE_SCENES
134-
static int Cleanup( int retval) ;
134+
static void Cleanup( std::string status_msg = std::string()) ;
135135

136136
// event handlers
137137
static void HandleKeyEvent( SDL_Event* event) ;

0 commit comments

Comments
 (0)