Re: First instance of plugin controls all other instances?
Re: First instance of plugin controls all other instances?
- Subject: Re: First instance of plugin controls all other instances?
- From: Stephen Blinkhorn <email@hidden>
- Date: Wed, 2 Feb 2011 10:55:57 -0600
On 2 Feb 2011, at 08:52, tahome izwah wrote:
I'd recommend reading a good book on Cocoa first - if you don't know
exactly what you're doing you shouldn't be releasing software...
Here's my favorite: Aaron Hillegass, "Cocoa Programming for Mac OS X"
Have to say, great book!
Regarding storing the current control value I usually do something
like the code below (standard Objective-C accessors). Oliver's example
won't compile on 10.4 if that's still important.
@class Slider
{
float floatValue;
}
-(void)setFloatValue:(float)value
{
floatValue = float;
}
-(float)floatValue
{
return floatValue;
}
Rather than use the member variable directly in code I find it easier
to use accessor methods. That way you can do some bounds checking in
the setFloatValue method and call other methods if required:
-(void)setFloatValue:(float)value
{
floatValue = float;
if(floatValue > 1.f) floatValue = 1.f; else if(floatValue < 0.f)
floatValue = 0.f;
}
Stephen | AudioSpillage
They also have great Cocoa classes at http://www.bignerdranch.com
HTH
--th
2011/2/2 Olivier Tristan <email@hidden>:
@class Foo
{
BOOL toto;
}
@property (nonatomic) BOOL toto;
@end
then you can access and assign toto directly with a Foo object
On 2/2/2011 3:43 PM, Artemiy Pavlov wrote:
I now understand, thanks! My Objective-C knowledge isn't that great
though, could you please give me a code snippet for how to create
a variable
within the existing view class? And how to then access it?
Thanks a lot again!
Artemiy.
On 2 Feb 2011, at 16:32, Olivier Tristan wrote:
You should use class member variable not global variable.
HTH
On 2/2/2011 3:24 PM, Artemiy Pavlov wrote:
On 2 Feb 2011, at 15:47, Olivier Tristan wrote:
static declared datas ?
When I track the mouse movements, I store the calculated control
values
in variables which are global to all view's methods.
A quick and dirty example:
Float32 ControlValue;
-(void)drawRect{
// draw something according to ControlValue
}
-(void)mouseDragged{
ControlValue = ... // calculated from mouse location.x/location.y
[super setNeedsDisplay:YES];
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
--
Olivier Tristan
Ultimate Sound Bank
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
--
Olivier Tristan
Ultimate Sound Bank
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden