objective c - Weird popping noise when playing different sounds with different volumes set through OpenAL on the iPhone -


I am using the OpenAL sound framework on iPhone, and I am setting different amounts on different sounds. I am running into a problem where I am listening to initial popping / click noise while switching from one voice to another.

This is really noticeable when I have a volume that is high volume (1.0) and another sound which has less one (0.2). When I hit the loud sound, and then hit the soft sound, I heard the pop / click but when I go out loud with soft sound, I do not know anything. So pop / click actually happens when loud switches are switched on.

Here's the input sound method:

  - (id) initWithSoundFile: (NSString *) file doesLoop: (BOOL) loops {self = [super init]; If (self! = Zero) {if (! [Self loadSoundFile: file doesLoop: loops]) {debug (@ "Failed to load sound file:% @ ...", file); [Self release]; Return zero; } Self.sourceFileName = File; // Temporary Sound Queue Self. Floating sound = [NSMutableArray array]; // Default volume / pitch self.volume = 1.0; Self.pitch = 1.0; } Healthy return; }  

And here is the play function:

  - (BOOL) Play {if ([self isplaying]) // See if the original source is busy or No ... {// If so, create a new source NSUntenger TMPSOSIDID; Alzan Sources (1, and TMPSOSIDID); // Attach buffer from source to alosory (tmpSourceID, AL_BUFFER, buffer ID); AlSourcePlay (tmpSourceID); // Add sound id in the play queue so that we can then displace later [Temporary add addobject: [UNININGAM: TMPSOSIDIDI with NSNumber Number]]; // When a "callback" is run for sound, then +0.1 seconds [Self display selector: Object with @Silator (DelightTemporary Soros): After zero: (duration * pitch) + 0.1]; Return ((error = alGetError ())! = AL_NO_ERROR; } // If the original source is not busy, then just use that one ... alSourcePlay (sourceID); Return ((error = alGetError ())! = AL_NO_ERROR; }  

And here's the function where I set it immediately after setting the quantity for each sound (also tried to install it before playing):

  - (zero) set volume: (alpha) newwolum {volume = max (minimum (new volume, 1.0 f), 0.0 f); // cap 0-1 alosource (sourceID, AL_GAIN, volume); // Now set the quantity for a temporary sound ... for (Temporal sound in NSNumber * tmpSourceID) {// tmpSourceID is the source ID for temporary sound alSourcef ([tmpSourceID unsigned integerValue], AL_GAIN, volume); }}  

Any help is greatly appreciated because I can do whatever I thought. I will be very grateful

Instead of allocation of memory to all I had to do, callok instead of malloc Was the open buffer or you can set the memory with the memet.

Strange popping noise turned away. This was due to the junk memory in my case. This is why it was also random. Hope it helps.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -