electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Articles  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links  |  Store
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
Live streaming at radio.electro-music.com

  host / artist show at your time
  Twyndyllyngs Live Chez Mosc
Please visit the chat
 Forum index » DIY Hardware and Software » ChucK programming language
Crash when initing a ugen to null
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [8 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
minuskelvin



Joined: Jul 03, 2015
Posts: 5
Location: seattle

PostPosted: Fri Jul 03, 2015 11:07 pm    Post subject: Crash when initing a ugen to null Reply with quote  Mark this post and the followings unread

Hey guys, I'm new to learning ChucK (about a week or so of digging in) so I'm not sure if this is even a thing, but I'm assuming crashing the miniaudicle with one line consistently is a "bug".

Here's the 1 liner:

Code:
null => SinOsc foo;


Also crashes is you null-init a Chubgraph.

Code:
class Foo extends Chubgraph {}
null => Foo foo;


I discovered this because I wanted to have a class wrap a UGen but have that UGen created outside the class. I didn't want to instantiate 2 UGens when I only wanted one.

Code:
class Wrapper
{
    // null this guy...
    null => MyChubgraph foo;

   // set it from outside
   fun void SetObj(MyChubgraph inFoo)
   {
        inFoo @=> foo;
   }

}


I was led to believe that null-initing a UGen was cool cause I was doing it with other non-UGen type objects. For example, this doesn't crash:

Code:
class MyClass {
   <<< "inside pre-init " >>>;
}
null => MyClass foo;

if (foo == null) { <<< "It is null." >>>; }


Also, I'm not really sure if null-initing an object really saves me anything or if it really matters. For what it's worth, that pre-init print *doesn't* occur if you null-init an object, so I'm guessing it saves me something.

Since it was so easy and consistent to crash, I assumed it was a known issue, but google lead me to believe it wasn't. Or I have no idea how to google this crash.

EDIT: I'm running ChucK on Windows 8 with ChucK version 1.3.5.0 (chimera).
Back to top
View user's profile Send private message
Antimon



Joined: Jan 18, 2005
Posts: 4012
Location: Sweden
Audio files: 335
G2 patch files: 100

PostPosted: Sun Jul 05, 2015 10:58 pm    Post subject: Reply with quote  Mark this post and the followings unread

In what way does it crash - does the miniaudicle program shut down or do you just get an error text somewhere?

Anyway, you can use @ do declare stuff as references rather than instances. This ought to work:

Code:
null @=> SinOsc @ foo;

_________________
Antimon's Window
@soundcloud @Flattr home - you can't explain music
Back to top
View user's profile Send private message Visit poster's website
minuskelvin



Joined: Jul 03, 2015
Posts: 5
Location: seattle

PostPosted: Tue Jul 07, 2015 11:45 am    Post subject: Reply with quote  Mark this post and the followings unread

Antimon wrote:
In what way does it crash - does the miniaudicle program shut down or do you just get an error text somewhere?

Anyway, you can use @ do declare stuff as references rather than instances. This ought to work:

Code:
null @=> SinOsc @ foo;


It crashes. Asks if I want to attach a debugger. No other text. It's a straight-up crash. Try it... should crash for you pretty easily. If it's not allowed or is invalid syntax it shouldn't compile or it should put the ugen in a bad state (and log error messages).

Anyway, didn't know about declaring things as ref like that! That will definitely work for me.

Thanks.
Back to top
View user's profile Send private message
Antimon



Joined: Jan 18, 2005
Posts: 4012
Location: Sweden
Audio files: 335
G2 patch files: 100

PostPosted: Tue Jul 07, 2015 1:14 pm    Post subject: Reply with quote  Mark this post and the followings unread

I must confess I don't use the miniAudicle, I'm a command line guy. Smile I agree that stuff shouldn't crash. Anyway, hope the @ stuff works!
_________________
Antimon's Window
@soundcloud @Flattr home - you can't explain music
Back to top
View user's profile Send private message Visit poster's website
minuskelvin



Joined: Jul 03, 2015
Posts: 5
Location: seattle

PostPosted: Tue Jul 07, 2015 2:38 pm    Post subject: Reply with quote  Mark this post and the followings unread

Antimon wrote:
I must confess I don't use the miniAudicle, I'm a command line guy. Smile I agree that stuff shouldn't crash. Anyway, hope the @ stuff works!


So, I'm new to ChucK and am super outgrowing miniAudicle -- since it doesn't do debugging anyway, I'm thinking it'd be way better to do this stuff using a more robust text editor (of course!). What's your typical workflow if you don't use miniAudicle? What editor do you use?
Back to top
View user's profile Send private message
Antimon



Joined: Jan 18, 2005
Posts: 4012
Location: Sweden
Audio files: 335
G2 patch files: 100

PostPosted: Wed Jul 08, 2015 6:37 am    Post subject: Reply with quote  Mark this post and the followings unread

minuskelvin wrote:
Antimon wrote:
I must confess I don't use the miniAudicle, I'm a command line guy. Smile I agree that stuff shouldn't crash. Anyway, hope the @ stuff works!


So, I'm new to ChucK and am super outgrowing miniAudicle -- since it doesn't do debugging anyway, I'm thinking it'd be way better to do this stuff using a more robust text editor (of course!). What's your typical workflow if you don't use miniAudicle? What editor do you use?


I've tried a couple of editors, but recently I found a ChucK mode for Sublime Text, which is a popular editor for coders. I keep a terminal next to it for running chuck - very probably there's a way to run it inside Sublime (or other editors where there are ChucK modes, like emacs), but as I said I like terminals. Smile

Sublime isn't the cheapest editor around though - I used a ChucK mode in jEdit for a while I think, that worked ok. Before I wanted syntax highlighting I just went with any editor really - I still tend to use vi for doing quick tests, when I don't feel like waiting for a bigger text editor to start up.

_________________
Antimon's Window
@soundcloud @Flattr home - you can't explain music
Back to top
View user's profile Send private message Visit poster's website
minuskelvin



Joined: Jul 03, 2015
Posts: 5
Location: seattle

PostPosted: Thu Jul 09, 2015 4:27 pm    Post subject: Reply with quote  Mark this post and the followings unread

Excellent -- I use Sublime Text all the time. I should have checked if there was a ChucK syntax highlighting mode.
I'll miss the audicle niceties i guess, but you can't beat being able to find and replace. Smile

Thanks for the advice.
Back to top
View user's profile Send private message
Antimon



Joined: Jan 18, 2005
Posts: 4012
Location: Sweden
Audio files: 335
G2 patch files: 100

PostPosted: Thu Jul 09, 2015 10:49 pm    Post subject: Reply with quote  Mark this post and the followings unread

Perfect - you've got the best alternative just around the corner then! thumleft
_________________
Antimon's Window
@soundcloud @Flattr home - you can't explain music
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [8 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » ChucK programming language
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum
e-m mkii

Please support our site. If you click through and buy from
our affiliate partners, we earn a small commission.


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use