<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: iPhone Game Programming &#8211; Tutorial 9 &#8211; Sound Manager</title>
	<atom:link href="http://www.71squared.com/2009/05/iphone-game-programming-tutorial-9-sound-manager/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.71squared.com/2009/05/iphone-game-programming-tutorial-9-sound-manager/</link>
	<description>iPhone Game Development - Web Development</description>
	<lastBuildDate>Wed, 28 Jul 2010 17:12:50 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: mike</title>
		<link>http://www.71squared.com/2009/05/iphone-game-programming-tutorial-9-sound-manager/comment-page-13/#comment-3694</link>
		<dc:creator>mike</dc:creator>
		<pubDate>Wed, 14 Jul 2010 06:53:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.71squared.co.uk/?p=560#comment-3694</guid>
		<description>Hi Barry

Can you email an example of a sound file doing this to mike@71squared.com and I&#039;ll take a look.

Thanks

Mike</description>
		<content:encoded><![CDATA[<p>Hi Barry</p>
<p>Can you email an example of a sound file doing this to <a href="mailto:mike@71squared.com">mike@71squared.com</a> and I&#8217;ll take a look.</p>
<p>Thanks</p>
<p>Mike</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Barry</title>
		<link>http://www.71squared.com/2009/05/iphone-game-programming-tutorial-9-sound-manager/comment-page-13/#comment-3692</link>
		<dc:creator>Barry</dc:creator>
		<pubDate>Tue, 13 Jul 2010 20:49:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.71squared.co.uk/?p=560#comment-3692</guid>
		<description>CORRECTION:
It may be the LEFT channel to which the mono sounds are going.  In any case, the mono sounds are only going to one of the channels, not both.

Thanks,
Barry</description>
		<content:encoded><![CDATA[<p>CORRECTION:<br />
It may be the LEFT channel to which the mono sounds are going.  In any case, the mono sounds are only going to one of the channels, not both.</p>
<p>Thanks,<br />
Barry</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Barry</title>
		<link>http://www.71squared.com/2009/05/iphone-game-programming-tutorial-9-sound-manager/comment-page-13/#comment-3691</link>
		<dc:creator>Barry</dc:creator>
		<pubDate>Tue, 13 Jul 2010 19:33:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.71squared.co.uk/?p=560#comment-3691</guid>
		<description>Hi Mike,

I love your Sound Manager -- great stuff!  But I have a problem...

I was using a very old version of Sound Manager (one of your earliest versions), and all of the volume levels on my 16-bit sounds (some mono, some stereo) were balanced nicely.  I then upgraded to the latest version of Sound Manager -- which caused all of my MONO sounds to have very low volume levels (even though their gains are set to 1.0f, and the master sound FX volume is set to 1.0f).

It appears that all of the mono sounds are only coming out of the RIGHT channel (which is probably causing the low volume).  However, with the old Sound Manager, the mono sounds were coming out of both the right and left channels.

How do I get the new Sound Manager to send the mono sounds to both channels?

Thanks for your help!

Barry</description>
		<content:encoded><![CDATA[<p>Hi Mike,</p>
<p>I love your Sound Manager &#8212; great stuff!  But I have a problem&#8230;</p>
<p>I was using a very old version of Sound Manager (one of your earliest versions), and all of the volume levels on my 16-bit sounds (some mono, some stereo) were balanced nicely.  I then upgraded to the latest version of Sound Manager &#8212; which caused all of my MONO sounds to have very low volume levels (even though their gains are set to 1.0f, and the master sound FX volume is set to 1.0f).</p>
<p>It appears that all of the mono sounds are only coming out of the RIGHT channel (which is probably causing the low volume).  However, with the old Sound Manager, the mono sounds were coming out of both the right and left channels.</p>
<p>How do I get the new Sound Manager to send the mono sounds to both channels?</p>
<p>Thanks for your help!</p>
<p>Barry</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://www.71squared.com/2009/05/iphone-game-programming-tutorial-9-sound-manager/comment-page-13/#comment-3524</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Fri, 04 Jun 2010 06:27:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.71squared.co.uk/?p=560#comment-3524</guid>
		<description>Hi Mike,

I&#039;ve been trying to get the stopSoundWithKey method to work and this is what I ended up with which seems to work so far.

- (void)stopSoundWithKey:(NSString *)key {
	NSNumber *index = [soundLibrary objectForKey:key];
	if (index == nil) return;
	NSUInteger sourceID = [index unsignedIntValue];
	alSourceStop(sourceID - 32);
}

It seems the reason the alSourceStop wasn&#039;t working is because the original sourceID of the sound was 2400 when I checked, but the sourceID returned by the [soundLibrary objectForKey:key] call was 2432 which was wrong. I couldn&#039;t figure out why the value was off by 32. The above solution is a hack but it seems to work.

Also awesome tutorials!</description>
		<content:encoded><![CDATA[<p>Hi Mike,</p>
<p>I&#8217;ve been trying to get the stopSoundWithKey method to work and this is what I ended up with which seems to work so far.</p>
<p>- (void)stopSoundWithKey:(NSString *)key {<br />
	NSNumber *index = [soundLibrary objectForKey:key];<br />
	if (index == nil) return;<br />
	NSUInteger sourceID = [index unsignedIntValue];<br />
	alSourceStop(sourceID &#8211; 32);<br />
}</p>
<p>It seems the reason the alSourceStop wasn&#8217;t working is because the original sourceID of the sound was 2400 when I checked, but the sourceID returned by the [soundLibrary objectForKey:key] call was 2432 which was wrong. I couldn&#8217;t figure out why the value was off by 32. The above solution is a hack but it seems to work.</p>
<p>Also awesome tutorials!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TrevorNewsome</title>
		<link>http://www.71squared.com/2009/05/iphone-game-programming-tutorial-9-sound-manager/comment-page-13/#comment-3385</link>
		<dc:creator>TrevorNewsome</dc:creator>
		<pubDate>Wed, 12 May 2010 19:16:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.71squared.co.uk/?p=560#comment-3385</guid>
		<description>Hi Mike,
That works like a dream, thank you very much, my game is nearly complete and wouldn&#039;t have been possible without your fantastic tutorials and snippets of help. I have made sure you have a mention in my credits with also a link to this website. As soon as I get the application submitted (hopefully in two weeks) I will post you a link to it.
Cheers again Trevor.</description>
		<content:encoded><![CDATA[<p>Hi Mike,<br />
That works like a dream, thank you very much, my game is nearly complete and wouldn&#8217;t have been possible without your fantastic tutorials and snippets of help. I have made sure you have a mention in my credits with also a link to this website. As soon as I get the application submitted (hopefully in two weeks) I will post you a link to it.<br />
Cheers again Trevor.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mike</title>
		<link>http://www.71squared.com/2009/05/iphone-game-programming-tutorial-9-sound-manager/comment-page-12/#comment-3381</link>
		<dc:creator>mike</dc:creator>
		<pubDate>Wed, 12 May 2010 08:12:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.71squared.co.uk/?p=560#comment-3381</guid>
		<description>Hi Trevor, try the method below which is what I use in the sound manager for SLQ.
&lt;pre&gt;
- (void)stopSoundWithKey:(NSString*)aSoundKey {

	// Reset errors in OpenAL
	alError = alGetError();
	alError = AL_NO_ERROR;
	
    // Find the buffer which has been linked to the sound key provided
    NSNumber *numVal = [soundLibrary objectForKey:aSoundKey];
    
    // If the key is not found log it and finish
    if(numVal == nil) {
        NSLog(@&quot;WARNING - SoundManager: No sound with key &#039;%@&#039; was found so cannot be stopped&quot;, aSoundKey);
        return;
    }
    
    // Get the buffer number from
    NSUInteger bufferID = [numVal unsignedIntValue];
	NSInteger bufferForSource;
	for(NSNumber *sourceID in soundSources) {
		
		NSUInteger currentSourceID = [sourceID unsignedIntValue];
		
		// Grab the buffer currently bound to this source
		alGetSourcei(currentSourceID, AL_BUFFER, &amp;bufferForSource);
		
		// If the buffer matches the buffer we want to stop then stop the source and unbind it from the buffer
		if(bufferForSource == bufferID) {
			alSourceStop(currentSourceID);
			alSourcei(currentSourceID, AL_BUFFER, 0);
		}
	} 

	// Check for any errors
	if((alError = alGetError()) != AL_NO_ERROR)
		NSLog(@&quot;ERROR - SoundManager: Could not stop sound with key &#039;%@&#039; got error %x&quot;, aSoundKey, alError);
}&lt;/pre&gt;

Let me know how you get on.

Mike</description>
		<content:encoded><![CDATA[<p>Hi Trevor, try the method below which is what I use in the sound manager for SLQ.</p>
<pre>
- (void)stopSoundWithKey:(NSString*)aSoundKey {

	// Reset errors in OpenAL
	alError = alGetError();
	alError = AL_NO_ERROR;

    // Find the buffer which has been linked to the sound key provided
    NSNumber *numVal = [soundLibrary objectForKey:aSoundKey];

    // If the key is not found log it and finish
    if(numVal == nil) {
        NSLog(@"WARNING - SoundManager: No sound with key '%@' was found so cannot be stopped", aSoundKey);
        return;
    }

    // Get the buffer number from
    NSUInteger bufferID = [numVal unsignedIntValue];
	NSInteger bufferForSource;
	for(NSNumber *sourceID in soundSources) {

		NSUInteger currentSourceID = [sourceID unsignedIntValue];

		// Grab the buffer currently bound to this source
		alGetSourcei(currentSourceID, AL_BUFFER, &#038;bufferForSource);

		// If the buffer matches the buffer we want to stop then stop the source and unbind it from the buffer
		if(bufferForSource == bufferID) {
			alSourceStop(currentSourceID);
			alSourcei(currentSourceID, AL_BUFFER, 0);
		}
	} 

	// Check for any errors
	if((alError = alGetError()) != AL_NO_ERROR)
		NSLog(@"ERROR - SoundManager: Could not stop sound with key '%@' got error %x", aSoundKey, alError);
}</pre>
<p>Let me know how you get on.</p>
<p>Mike</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TrevorNewsome</title>
		<link>http://www.71squared.com/2009/05/iphone-game-programming-tutorial-9-sound-manager/comment-page-12/#comment-3380</link>
		<dc:creator>TrevorNewsome</dc:creator>
		<pubDate>Wed, 12 May 2010 07:50:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.71squared.co.uk/?p=560#comment-3380</guid>
		<description>In the sound manager there is no way to stopsoundwithkey function, is there a simple way of doing this? I have a sound on loop but I have no way of stopping it.

- (void) stopSoundWithKey:(NSString*)theSoundKey {
	
}

Best wishes Trevor.</description>
		<content:encoded><![CDATA[<p>In the sound manager there is no way to stopsoundwithkey function, is there a simple way of doing this? I have a sound on loop but I have no way of stopping it.</p>
<p>- (void) stopSoundWithKey:(NSString*)theSoundKey {</p>
<p>}</p>
<p>Best wishes Trevor.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Simon</title>
		<link>http://www.71squared.com/2009/05/iphone-game-programming-tutorial-9-sound-manager/comment-page-12/#comment-3039</link>
		<dc:creator>Simon</dc:creator>
		<pubDate>Thu, 08 Apr 2010 09:42:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.71squared.co.uk/?p=560#comment-3039</guid>
		<description>Hi Mike,

I wanted to check that I was right in my thinking that the AVAudioSessionDelegate protocal cannot be used on older version of the OS such as 2.2.1.

I only ask as when I try and created a release version of my game for 2.2.1 I get an error message complaining that AVAudioSessionDelegate declaration cannot be found. 

I just wondered if by including this I&#039;m not excluding certain people from running my app.


Have you has a similar experience? 

Please note I only get this error one building a release version and only if the release is for 2.2.1</description>
		<content:encoded><![CDATA[<p>Hi Mike,</p>
<p>I wanted to check that I was right in my thinking that the AVAudioSessionDelegate protocal cannot be used on older version of the OS such as 2.2.1.</p>
<p>I only ask as when I try and created a release version of my game for 2.2.1 I get an error message complaining that AVAudioSessionDelegate declaration cannot be found. </p>
<p>I just wondered if by including this I&#8217;m not excluding certain people from running my app.</p>
<p>Have you has a similar experience? </p>
<p>Please note I only get this error one building a release version and only if the release is for 2.2.1</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kev</title>
		<link>http://www.71squared.com/2009/05/iphone-game-programming-tutorial-9-sound-manager/comment-page-12/#comment-2769</link>
		<dc:creator>Kev</dc:creator>
		<pubDate>Thu, 25 Feb 2010 15:06:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.71squared.co.uk/?p=560#comment-2769</guid>
		<description>As a follow up to my post above: I am finding that when trying to play long MP3s the delay in getting the sound ready results in problems with the touch interface and accelerometers. By breaking up the conversion it prevents these problems (presumably by letting the OS get a look in frequently enough).

PS. Briliant article!</description>
		<content:encoded><![CDATA[<p>As a follow up to my post above: I am finding that when trying to play long MP3s the delay in getting the sound ready results in problems with the touch interface and accelerometers. By breaking up the conversion it prevents these problems (presumably by letting the OS get a look in frequently enough).</p>
<p>PS. Briliant article!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kev</title>
		<link>http://www.71squared.com/2009/05/iphone-game-programming-tutorial-9-sound-manager/comment-page-12/#comment-2768</link>
		<dc:creator>Kev</dc:creator>
		<pubDate>Thu, 25 Feb 2010 14:46:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.71squared.co.uk/?p=560#comment-2768</guid>
		<description>I want to be able to break up the conversion of long mp3s and display % complete.
Is there a way to append more data to an existing buffer along the lines of (in alBufferDataStaticProc) doing something like this (but with some sort of append call instead of starting again)?
if (proc)
{
  int chunkSize = 100;
  int chunk = size / chunkSize;
  int offset = 0;
  for (int i=0; i&lt;chunkSize; ++i)
  {
    /*
    call to update graphics with % complete
    */
    proc(bid, format, data + offset, chunk, freq);
			offset += chunk;
  }
}

Obviously this just leave the last 1% of the track in the buffer.

Thanks,
Kev</description>
		<content:encoded><![CDATA[<p>I want to be able to break up the conversion of long mp3s and display % complete.<br />
Is there a way to append more data to an existing buffer along the lines of (in alBufferDataStaticProc) doing something like this (but with some sort of append call instead of starting again)?<br />
if (proc)<br />
{<br />
  int chunkSize = 100;<br />
  int chunk = size / chunkSize;<br />
  int offset = 0;<br />
  for (int i=0; i&lt;chunkSize; ++i)<br />
  {<br />
    /*<br />
    call to update graphics with % complete<br />
    */<br />
    proc(bid, format, data + offset, chunk, freq);<br />
			offset += chunk;<br />
  }<br />
}</p>
<p>Obviously this just leave the last 1% of the track in the buffer.</p>
<p>Thanks,<br />
Kev</p>
]]></content:encoded>
	</item>
</channel>
</rss>
