0
두 개의 독립적 인 UISliders와 UIPanGestureRecognizer를 사용하는 XY 패드의 두 가지 방법으로 파형의 음량과 음높이를 제어하는 두 가지 방법이있는 libpd를 사용하여 뮤지컬 앱을 만들고 있습니다.UIPlGestureRecognizer를 UISlider에 링크 하시겠습니까?
XY 패드의 동작을 슬라이더에 반영 시켜서 어떻게 가능했는지 궁금합니다. (즉, Y 축은 이미 볼륨을 제어 중이지만 슬라이더가 해당 볼륨에 반응하는지 확인합니다.)
여기서는 별도의 컨트롤을 사용합니다.
// Volume slider
-(IBAction)sineVol:(id)sender
{
UISlider *vslider = (UISlider *)sender;
[PdBase sendFloat:vslider.value toReceiver:@"sine_vol"];
}
// Pitch slider
-(IBAction)sinePitch:(id)sender
{
UISlider *pslider = (UISlider *)sender;
[PdBase sendFloat:pslider.value toReceiver:@"sine_pitch"];
}
// XY Pad
-(IBAction)sineXYPad:(UIPanGestureRecognizer *)trigger
{
float sinepadHeight = sinexyview.bounds.size.height;
float sinepadWidth = sinexyview.bounds.size.width;
CGPoint location = [trigger locationInView:sinexyview];
if ((location.y >= 0) && (location.y < sinepadHeight) && (location.x >= 0) && (location.x < sinepadWidth))
{
float sineVolXY = ((location.y)/250);
[PdBase sendFloat:sineVolXY toReceiver:@"sine_vol"];
}
if ((location.y >= 0) && (location.y < sinepadHeight) && (location.x >= 0) && (location.x < sinepadWidth))
{
float sinePitchXY = ((location.x)/5);
[PdBase sendFloat:sinePitchXY toReceiver:@"sine_pitch"];
}
}