Skip to content
This repository was archived by the owner on Jul 17, 2024. It is now read-only.
This repository was archived by the owner on Jul 17, 2024. It is now read-only.

Popping when playing multiple sounds #15

@NickCulbertson

Description

@NickCulbertson

Hey Zoel,
I've been trying to go off of your Finch Code to play multiple sounds at the same time. If the first sound is playing a pop occurs when the second sound begins which I think is a result of the sound not being preloaded to a buffer. I found some other source codes for openal around the web but they negate the ease of Finch.

here is how I create and play the sounds

string1 = [[Sound alloc] initWithFile:[[NSBundle mainBundle] URLForResource:@"Sound1" withExtension:@"wav"]];
string2 = [[Sound alloc] initWithFile:[[NSBundle mainBundle] URLForResource:@"Sound2" withExtension:@"wav"]];
[string1 play];
[string2 play];

also in Sound.m I tried commenting out the stop.

- (void) play
{
    // if (self.playing)
    // [self stop];
    CLEAR_ERROR_FLAG;
    alSourcePlay(source);
    [self checkSuccessOrLog:@"Failed to start sound"];
}

This eliminates the pop from the sounds if the sound is currently playing.

play1 
play2 *pop*
play1 (play1 and play2 still playing) no pop
play2 (play1 and play2 still playing) no pop
play1 (play1 NOT currently playing and play2 still playing) *pop*

I hope that kind of makes sense. The pop occurs when a sound goes from a non playing state to a playing state while the other sound is playing.

Any advice would be appreciated. I'm been on this thing for weeks now.
Thanks,
Nick

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions