Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

nickculbertson

macrumors regular
Original poster
Nov 19, 2010
226
0
Nashville, TN
Hello,
I'm using the Finch OpenAL code for playing sounds using OpenAL. I eliminated the popping that occurs when a sound is played for a second time by adding an second identical sound and fading the volume of the first sound to 0.
Code:
if (Count41==1){
				Count41==2;
				sound2.gain = slider.value/20;
				[self performSelector:@selector (stop1) withObject:nil afterDelay:0.05];
				[sound play];
			}else if (Count41==2){
				Count41==1;
				sound1.gain = slider.value/20;
				[self performSelector:@selector (stop2) withObject:nil afterDelay:0.05];
				[sound2 play];
			}

The problem is when I play a third sound as the sound1 or sound2 are playing a pop occurs. play1 and play2 at the same time.

Code:
-(IBAction)play1{
if (Count41==1){
				Count41==2;
				sound2.gain = slider.value/20;
				[self performSelector:@selector (stop1) withObject:nil afterDelay:0.05];
				[sound play];
			}else if (Count41==2){
				Count41==1;
				sound1.gain = slider.value/20;
				[self performSelector:@selector (stop2) withObject:nil afterDelay:0.05];
				[sound2 play];
			}
}

-(IBAction)play2{
if (Count41==1){
				Count42==2;
				sound4.gain = slider.value/20;
				[self performSelector:@selector (stop1) withObject:nil afterDelay:0.05];
				[sound3 play];
			}else if (Count42==2){
				Count42==1;
				sound3.gain = slider.value/20;
				[self performSelector:@selector (stop2) withObject:nil afterDelay:0.05];
				[sound4 play];
			}
}

Any ideas on how to start a sound as one is already playing without the pop sound occurring.

Thanks,
Nick
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.