Skip to content

paoloboschini/ADSR

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ADSR

Customizable ADSR Controller

alt tag

Features

  • Customizable appearance
  • Customizable value range

Basic Usage

See example project for a demo.

// create an ADSR, set custom value range independent from ADSR frame width
ADSR *adsr = [[ADSR alloc] initWithFrame:NSMakeRect(10, 10, 400, 100)
                         withAttackRange:50
                          withDecayRange:60
                        withSustainRange:70
                        withReleaseRange:80
                               withColor:[NSColor greenColor]
                     withBackgroundColor:[NSColor blackColor]];

// Set the ADSR's delegate (must conform to ADSRProtocol and implement four update methods...)
adsr.delegate = self;
    
// Add ADSR to window
[self.window.contentView addSubview:adsr];

...

// called upon attack update
- (void)attackUpdatedWithValue:(int)value
{
    NSLog(@"Attack: %d", value);
}

// called upon decay update
- (void)decayUpdatedWithValue:(int)value
{
    NSLog(@"Decay: %d", value);
}

// called upon sustain update
- (void)sustainUpdatedWithValue:(int)value
{
    NSLog(@"Sustain: %d", value);
}

// called upon release update
- (void)releaseUpdatedWithValue:(int)value
{
    NSLog(@"Release: %d", value);
}

About

Customizable ADSR Controller

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published