Csound Csound-dev Csound-tekno Search About

Load preset Segmentation Fault ??

Date2005-11-17 17:28
FromDavid Akbari
SubjectLoad preset Segmentation Fault ??
Why is this occuring ?? I am try to load presets, and it loads the 
first value but then segfaults. It works fine in it's own orchestra.

Is it a user error in the way of not initializing values correctly ???

Date/Time:      2005-11-17 12:23:48 -0500
OS Version:     10.3.9 (Build 7W98)
Report Version: 2

Command: csound
Path:    ./csound
Version: ??? (???)
PID:     847
Thread:  0

Exception:  EXC_BAD_ACCESS (0x0001)
Codes:      KERN_INVALID_ADDRESS (0x0001) at 0xfffffffc

Thread 0 Crashed:
0   libwidgets.dylib               	0x0101ce84 std::basic_string, std::allocator 
 >::basic_string[unified](std::basic_string, std::allocator > const&) + 0x28
1   libwidgets.dylib               	0x0100e7f4 
SNAPSHOT::get(std::vector >&) + 0xa4
2   libwidgets.dylib               	0x0100f22c get_snap + 0x90
3   csound                         	0x00035114 insert + 0x4a4
4   csound                         	0x000162b8 process_score_event + 
0x418
5   csound                         	0x00016414 process_rt_event + 0x74
6   csound                         	0x00014aa0 sensevents + 0x4bc
7   csound                         	0x00003b8c csoundPerform + 0x70
8   csound                         	0x00002440 main + 0x20c
9   csound                         	0x00001f64 _start + 0x188 
(crt.c:267)
10  csound                         	0x00001dd8 start + 0x30

Here's the standalone version that works fine:





sr		=	44100
kr		=	441
ksmps	=	100
nchnls	=	2

giport	OSCinit	47110

#include	"_presetUI.h"

#include	"_udo.h"

#define	SNAPSHOTSFILE	# "presetTest.txt" #

/*--- ---*/

		instr	1

knum, kval	footarray

if	(knum == 0 && kval == 1) kgoto pres0
if	(knum == 1 && kval == 1) kgoto pres0
if	(knum == 2 && kval == 1) kgoto pres0
if	(knum == 3 && kval == 1) kgoto pres0
if	(knum == 4 && kval == 1) kgoto pres0
if	(knum == 5 && kval == 1) kgoto pres0
if	(knum == 6 && kval == 1) kgoto pres0
if	(knum == 7 && kval == 1) kgoto pres0
if	(knum == 8 && kval == 1) kgoto pres0
if	(knum == 9 && kval == 1) kgoto pres0
	kgoto ex

   pres0:
gknum	=	knum
	event	"i", 104, 0, 0.01
	kgoto exe

   ex:
		endin

/*--- ---*/

		instr 101	;Save snapshots into RAM

inumsnap,inumval	FLsetsnap	i(gkGet)

		endin

/*--- ---*/

		instr 102	;Load snapshots

		FLloadsnap	$SNAPSHOTSFILE
inumsnap 	FLgetsnap	i(gkGet)
	FLsetVal	1, gkGet, gidum1

		endin

/*--- ---*/

		instr 103	;Save snapshots onto disk

	FLsavesnap	$SNAPSHOTSFILE

		endin

/*--- ---*/

		instr 104	;Load snapshots

		FLloadsnap	$SNAPSHOTSFILE
inumsnap 	FLgetsnap	i(gknum)
	FLsetVal	1, gknum, gidum1

		endin

/*--- ---*/


i1	0	1000

e




The interface header file:

/*=== begin "_presetUI.h" ===*/

	FLpanel "Preset Test", 800, 600, 100, 100, 7
gkslid1, gid1   FLslider	"Ball1", 0, 127, 0, 4, -1, 16, 300, 50, 50
gkslid2, gid2   FLslider	"Ballse2", 0, 127, 0, 4, -1, 16, 300, 100, 50
gkslid3, gid3   FLslider	"Ballse3", 0, 127, 0, 4, -1, 16, 300, 150, 50
giprendx		FLvalue		"Preset Index", 80, 32, 200, 150
gkdum1, gidum1  FLslider	"dummyslider", 0, 9, 0, 4, giprendx, 2, 2, 
804, 604
			FLsetVal_i 0, giprendx
gksave,ihSV		FLbutton	"Save snap", 3,	0,	11,	85,	20,	550,	350,  
	+105,	101,	0,	0
			FLsetTextColor   128, 0, 0,  ihSV
gkload,ihload   FLbutton	"Load snap", 3,	0,	11,	85,	20,	635,	350,  
	+105,	102,	0,	0.01
gkreset,ihRA	FLbutton	"Write", 3,	0,	11,	70,	20,	720,	350,  
	+105,	103,	0,	0
			FLsetTextColor   0, 0, 255,  ihRA
gkGet,gihsnap	FLbutBank	12,	6,	8,	240,	150,	550,	375,	-105,	102,	0,	0	
			FLsetVal_i 0, gihsnap
ihsnap		FLbox		"Select button and click 
Save/Load",	1,	1,	14,	250,	10,	545,	530
			FLsetTextColor   192, 0, 0,  ihsnap
			FLsetTextSize  14, ihsnap
			FLsetTextType   5, ihsnap
	FLpanelEnd
   FLrun

/*=== end "_presetUI.h" ===*/


-David

Date2005-11-17 17:58
FromDavid Akbari
SubjectFLTK Implementation (was: Load preset Segmentation Fault ???)
OK so I find that by renaming the ihandle variable for the FLsliders I 
am now able to avoid these unstable behaviour.

However this message still shows up repeatedly :

WARNING: (SNAPSHOT::get): not implemented yet; exp=4

the Canonical Reference Manual also says a lot of "not implemented yet" 
for FLTK but yet there are examples of using these functions. Good 
examples of this point are found in the man pages for FLsetVal and 
FLsetVal_i.

What is actually implemented in FLTK and what is not?

I would be most interested to get an update to this information!


-David

On Nov 17, 2005, at 12:28 PM, David Akbari wrote:

> Why is this occuring ?? I am try to load presets, and it loads the 
> first value but then segfaults. It works fine in it's own orchestra.
>
> Is it a user error in the way of not initializing values correctly ???

Date2005-11-17 18:33
FromIstvan Varga
SubjectRe: Load preset Segmentation Fault ??
David Akbari wrote:

> Why is this occuring ?? I am try to load presets, and it loads the first 
> value but then segfaults. It works fine in it's own orchestra.

It appears that FLsetVal_i does not support FLvalue, so commenting
out the line 'FLsetVal_i 0, giprendx' did fix a crash, but there may
be other errors (more testing is needed).

Date2005-11-17 19:26
FromDavid Akbari
SubjectRe: Load preset Segmentation Fault ??
Also related to this, is there a reason that specifically the FLbutBank 
opcode would not save to a preset despite the fact that itype=[1,2,3,4] 
? The manual says that by adding 10 you skip adding it to a preset but 
it looks like it does not add it to the preset file even when 
itype=[1,2,3,4].

What source file is FLbutBank in ?

Here is a small example (using also the widgets to the previously 
posted interface header file) where itype=2 and yet I do not see it in 
the preset file ?

/*=== ===*/

		FLpanel "Routing", 999, 718, 10, 30, 4
iglovenum   =   11
inumparams  =   1
   FLcolor 0, 0, 181
gkbank1,ihb1  FLbutBank  2, iglovenum, inumparams, 522, 32, 50, 120, -1
gkbank2,ihb2  FLbutBank  2, iglovenum, inumparams, 522, 32, 50, 152, -1
gkbank3,ihb3  FLbutBank  2, iglovenum, inumparams, 522, 32, 50, 184, -1
gkbank4,ihb4  FLbutBank  2, iglovenum, inumparams, 522, 32, 50, 216, -1
gkbank5,ihb5  FLbutBank  2, iglovenum, inumparams, 522, 32, 50, 248, -1
gkbank6,ihb6  FLbutBank  2, iglovenum, inumparams, 522, 32, 50, 280, -1
gkbank7,ihb7  FLbutBank  2, iglovenum, inumparams, 522, 32, 50, 
280+(32), -1
gkbank8,ihb8  FLbutBank  2, iglovenum, inumparams, 522, 32, 50, 
280+(32*2), -1
gkbank9,ihb9  FLbutBank  2, iglovenum, inumparams, 522, 32, 50, 
280+(32*3), -1
gkbank10,ihb10  FLbutBank  2, iglovenum, inumparams, 522, 32, 50, 
280+(32*4), -1
gkbank11,ihb11  FLbutBank  2, iglovenum, inumparams, 522, 32, 50, 
280+(32*5), -1
   FLcolor -1
		FLpanelEnd

/*=== ===*/

Any help in this matter is much appreciated !


-David

On Nov 17, 2005, at 1:33 PM, Istvan Varga wrote:

> David Akbari wrote:
>
>> Why is this occuring ?? I am try to load presets, and it loads the 
>> first value but then segfaults. It works fine in it's own orchestra.
>
> but there may
> be other errors (more testing is needed).