Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6201447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:33:23+00:00 2026-05-24T04:33:23+00:00

I am working in Xcode on a synthesizer application. I am using custom sliders

  • 0

I am working in Xcode on a synthesizer application. I am using custom sliders and knobs. I want these to send control values to receivers in an embedded Pure Data patch (I am using libpd as a Pure Data library and wrapper).

I have multiple custom sliders and knobs on my interface. I want each one to send only their own control values independently of the other sliders/knobs.

I am using tags and a switch statement.
The problem is that only the first case is working and all of the sliders and knobs are sending control values to the same receiver.

- (void)viewDidLoad {
    [super viewDidLoad];

// Slider 1

    slider.tag = 0;
    slider = [[[DCSlider alloc] initWithDelegate:self] autorelease];
    slider.frame = CGRectMake(0,0,20,100);
    [self.sliderContainer addSubview: slider];


// Slider 2 

    slider2.tag = 1;    
    slider2 = [[[DCSlider alloc] initWithDelegate:self] autorelease];
    slider2.frame = CGRectMake(0,0,20,100); 
    [self.sliderContainer2 addSubview: slider2];    
}

and then I implement the method here…

- (void)controlValueDidChange:(float)value sender:(id)sender { 

    DCSlider *slidertag = (DCSlider *)sender;

    switch (slidertag.tag) 
    {
        case 0: 
        { 
            [PdBase sendFloat:value toReceiver:@"beatvol"];
        }
            break;
        case 1: 
        { 
            [PdBase sendFloat:value toReceiver:@"bassvol"];
        }
            break;
    }     
}

Can anyone help please? Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T04:33:24+00:00Added an answer on May 24, 2026 at 4:33 am

    Geez, still at it?

    You obviously need to assign a separate target for each slider!

    Also, in your example, you assign the tag before you create the slider, no good. You should always place your init before setting any properties.

    - (void)viewDidLoad 
    {
        [super viewDidLoad];
    
        // Slider 1
    
        slider = [[[DCSlider alloc] initWithDelegate:self] autorelease];
        slider.tag = 0;
        slider.frame = CGRectMake(0,0,20,100);
        [slider addTarget:self action:@selector(controlBassValueDidChange:) forControlEvents:UIControlEventValueChanged];
        [self.sliderContainer addSubview: slider];
    
        // Slider 2 
    
        slider2 = [[[DCSlider alloc] initWithDelegate:self] autorelease];
        slider2.tag = 1;
        slider2.frame = CGRectMake(0,0,20,100); 
        [slider2 addTarget:self action:@selector(controlBeatValueDidChange:) forControlEvents:UIControlEventValueChanged];
        [self.sliderContainer2 addSubview: slider2];    
    }
    
    - (void)controlBassValueDidChange:(float)value sender:(id)sender 
    { 
        [PdBase sendFloat:value toReceiver:@"bassvol"];
    }
    - (void)controlBeatValueDidChange:(float)value sender:(id)sender 
    { 
        [PdBase sendFloat:value toReceiver:@"beatvol"];
    }
    

    And if you are going to use my answer to your other question, the least you could do is give it an upvote. ;—]

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working up a custom Xcode template, and I'd like to change the way
I'm working with Xcode doing a Ipad app. i simply want user to click
I am currently using XCode 3.2.3 and iOS4. I'm working on an app that
What I'm doing: I'm working in Xcode, and started using Git not that long
HELLO, I am working on XCODE 3.1.4 , my iphone have 3.1.2 os...But as
While working on an Xcode project i keep getting the spinning wheel while switching
I'm working on a school project and I'm getting some weird errors from Xcode.
Something really weird is going on with Xcode and an iPhone project I'm working
I'm new to xcode and the iphone sdk. I've been working with the view-based
I have made a ViewController in XCode for an iPhone project I'm working on,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.