<?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: 3D Sound</title>
	<atom:link href="http://www.71squared.com/2009/05/3d-sound/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.71squared.com/2009/05/3d-sound/</link>
	<description>iPhone Game Development - Web Development</description>
	<lastBuildDate>Thu, 11 Mar 2010 18:02:16 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: MarsMan</title>
		<link>http://www.71squared.com/2009/05/3d-sound/comment-page-1/#comment-1183</link>
		<dc:creator>MarsMan</dc:creator>
		<pubDate>Wed, 08 Jul 2009 19:55:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.71squared.co.uk/?p=567#comment-1183</guid>
		<description>Mike- So many of us would dearly love to see an openAL tutorial on the creation of a musical instrument (like an electric guitar (using audio samples) with pitch bend capability.

Your tutorials ROCK my friend!</description>
		<content:encoded><![CDATA[<p>Mike- So many of us would dearly love to see an openAL tutorial on the creation of a musical instrument (like an electric guitar (using audio samples) with pitch bend capability.</p>
<p>Your tutorials ROCK my friend!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mike</title>
		<link>http://www.71squared.com/2009/05/3d-sound/comment-page-1/#comment-919</link>
		<dc:creator>mike</dc:creator>
		<pubDate>Sat, 13 Jun 2009 08:16:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.71squared.co.uk/?p=567#comment-919</guid>
		<description>Hi A Person

This is something I am putting into Tutorial 10 now.  It can be hard to work this stuff through so I&#039;m adding it to the next tutorial which will be out ASAP.

Hopefully that will be in time to help you.

Mike</description>
		<content:encoded><![CDATA[<p>Hi A Person</p>
<p>This is something I am putting into Tutorial 10 now.  It can be hard to work this stuff through so I&#8217;m adding it to the next tutorial which will be out ASAP.</p>
<p>Hopefully that will be in time to help you.</p>
<p>Mike</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: A Person</title>
		<link>http://www.71squared.com/2009/05/3d-sound/comment-page-1/#comment-918</link>
		<dc:creator>A Person</dc:creator>
		<pubDate>Sat, 13 Jun 2009 02:18:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.71squared.co.uk/?p=567#comment-918</guid>
		<description>Hey mike its me again and same for the same thing.

I still can&#039;t get the tiledMap layer collision detection to work and i&#039;ve tried many ways but it seems to be that the tile map is rendered by a mapX and mapY and a width and height along with a mapoint which makes finding out where the tiles are and if they are solid hard and i was wondering how your progress is with this.

Hope you can help and thanks for all your work so far</description>
		<content:encoded><![CDATA[<p>Hey mike its me again and same for the same thing.</p>
<p>I still can&#8217;t get the tiledMap layer collision detection to work and i&#8217;ve tried many ways but it seems to be that the tile map is rendered by a mapX and mapY and a width and height along with a mapoint which makes finding out where the tiles are and if they are solid hard and i was wondering how your progress is with this.</p>
<p>Hope you can help and thanks for all your work so far</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: A Person</title>
		<link>http://www.71squared.com/2009/05/3d-sound/comment-page-1/#comment-897</link>
		<dc:creator>A Person</dc:creator>
		<pubDate>Wed, 10 Jun 2009 02:10:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.71squared.co.uk/?p=567#comment-897</guid>
		<description>Thanks mike that&#039;s actually what I did on my first go at this so I&#039;ll revisit it and see what wasn&#039;t working.</description>
		<content:encoded><![CDATA[<p>Thanks mike that&#8217;s actually what I did on my first go at this so I&#8217;ll revisit it and see what wasn&#8217;t working.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mike</title>
		<link>http://www.71squared.com/2009/05/3d-sound/comment-page-1/#comment-889</link>
		<dc:creator>mike</dc:creator>
		<pubDate>Tue, 09 Jun 2009 13:45:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.71squared.co.uk/?p=567#comment-889</guid>
		<description>@A Person, thanks for the comment.  I&#039;ve not had a chance to look through your code in detail yet, but I&#039;ll check it out later.

What I tend to do with the tile map is set a property on tile images which should block the player, something like blocked = true.

When I load up the tile map I then run through the properties for each tile in the map and creation a collision map which is just an array that stores either a 0 or 1 for each tile in the map.  If the map tile blocks then the array is 1 else it is 0.

When I am then moving the player, I convert the players pixel coordinates into a tile map, simply by dividing the pixel location  by the tilewidth/height etc.  If that shows that moving the player would place them in a blocked tile I reverse the movement and leave them where they were.

Doing this is very simple and has worked well in the past.  I&#039;ll take a look at your code a little later.

Mike</description>
		<content:encoded><![CDATA[<p>@A Person, thanks for the comment.  I&#8217;ve not had a chance to look through your code in detail yet, but I&#8217;ll check it out later.</p>
<p>What I tend to do with the tile map is set a property on tile images which should block the player, something like blocked = true.</p>
<p>When I load up the tile map I then run through the properties for each tile in the map and creation a collision map which is just an array that stores either a 0 or 1 for each tile in the map.  If the map tile blocks then the array is 1 else it is 0.</p>
<p>When I am then moving the player, I convert the players pixel coordinates into a tile map, simply by dividing the pixel location  by the tilewidth/height etc.  If that shows that moving the player would place them in a blocked tile I reverse the movement and leave them where they were.</p>
<p>Doing this is very simple and has worked well in the past.  I&#8217;ll take a look at your code a little later.</p>
<p>Mike</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: A Person</title>
		<link>http://www.71squared.com/2009/05/3d-sound/comment-page-1/#comment-887</link>
		<dc:creator>A Person</dc:creator>
		<pubDate>Tue, 09 Jun 2009 13:07:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.71squared.co.uk/?p=567#comment-887</guid>
		<description>I think I see my mistake I have to use the actually map point in there some where not to hard to figure out.</description>
		<content:encoded><![CDATA[<p>I think I see my mistake I have to use the actually map point in there some where not to hard to figure out.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: A Person</title>
		<link>http://www.71squared.com/2009/05/3d-sound/comment-page-1/#comment-885</link>
		<dc:creator>A Person</dc:creator>
		<pubDate>Tue, 09 Jun 2009 01:42:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.71squared.co.uk/?p=567#comment-885</guid>
		<description>i meant the code tag (i typed     and it dissapeared)</description>
		<content:encoded><![CDATA[<p>i meant the code tag (i typed     and it dissapeared)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: A Person</title>
		<link>http://www.71squared.com/2009/05/3d-sound/comment-page-1/#comment-884</link>
		<dc:creator>A Person</dc:creator>
		<pubDate>Tue, 09 Jun 2009 01:40:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.71squared.co.uk/?p=567#comment-884</guid>
		<description>sorry mike i don&#039;t know what happened but i used the code but it didn&#039;t work</description>
		<content:encoded><![CDATA[<p>sorry mike i don&#8217;t know what happened but i used the code but it didn&#8217;t work</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: A Person</title>
		<link>http://www.71squared.com/2009/05/3d-sound/comment-page-1/#comment-883</link>
		<dc:creator>A Person</dc:creator>
		<pubDate>Tue, 09 Jun 2009 01:38:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.71squared.co.uk/?p=567#comment-883</guid>
		<description>Hey mike i gotten a lot of my collision detection class done and most of its working great except for layer collision detection so i can make layers a solid object if i want, i have object to object collision working great so here is my layer code which can get the collision for the second tile it hits (for some reason it skips the first) and it starts to move all jittery, the jiterryness can be fixed by giving a very very low speed but i still am not satisfied.  So now the code.
&lt;pre&gt;
- (void)detectCollisionForLayerNumber:(int)number rectObject:(Image*)objectOne speed:(CGPoint)speed delta:(float)delta direction:(int)direction {
	tileY = 0;
	tileX = 0;
	Layer *layer = [tiledMap.layers objectAtIndex:number];
	while(tileY &lt; layer.layerHeight) {
		while(tileX &lt; layer.layerWidth) {
			int globalID = [layer getGlobalTileIDAtX:tileX y:tileY];
			if(globalID != 0) {
				if([self rectObject:objectOne collisionWithRect:CGRectMake((tileX + 1) * [tiledMap tileWidth] - [tiledMap tileWidth], (tileY + 1) * [tiledMap tileHeight] - [tiledMap tileHeight], tiledMap.tileWidth, tiledMap.tileHeight)]) {
					if(direction == kDirection_Forward) {
						objectOne.origin = CGPointMake(objectOne.origin.x - speed.x * delta, objectOne.origin.y - speed.y * delta);
					} else if(direction == kDirection_Backwards) {
						objectOne.origin = CGPointMake(objectOne.origin.x + speed.x * delta, objectOne.origin.y + speed.y * delta);
					}
				}
			}			
			tileX++;
		}
		tileY++;
		tileX = 0;
	}
}
&lt;/pre&gt;

This isn&#039;t how i normally do this but i dont really care about doing anything else but stoping the object from going through that layer. Normally i return a yes or no and then i do what i what (that works).  I&#039;ve also tried getting info from the xml file without much success.  I also made changes to the image class and tiledmap class to support what i&#039;m doing for example origin and the layers array.  These changes work and i&#039;ve tried them multiple ways and it works but it keeps coming back to this method.  No errors are given to me on build so if there is a  ; missing or something its not that it was my copy and paste error.

Hope you can help mike and thanks for the great work you already been doing</description>
		<content:encoded><![CDATA[<p>Hey mike i gotten a lot of my collision detection class done and most of its working great except for layer collision detection so i can make layers a solid object if i want, i have object to object collision working great so here is my layer code which can get the collision for the second tile it hits (for some reason it skips the first) and it starts to move all jittery, the jiterryness can be fixed by giving a very very low speed but i still am not satisfied.  So now the code.</p>
<pre>
- (void)detectCollisionForLayerNumber:(int)number rectObject:(Image*)objectOne speed:(CGPoint)speed delta:(float)delta direction:(int)direction {
	tileY = 0;
	tileX = 0;
	Layer *layer = [tiledMap.layers objectAtIndex:number];
	while(tileY &lt; layer.layerHeight) {
		while(tileX &lt; layer.layerWidth) {
			int globalID = [layer getGlobalTileIDAtX:tileX y:tileY];
			if(globalID != 0) {
				if([self rectObject:objectOne collisionWithRect:CGRectMake((tileX + 1) * [tiledMap tileWidth] - [tiledMap tileWidth], (tileY + 1) * [tiledMap tileHeight] - [tiledMap tileHeight], tiledMap.tileWidth, tiledMap.tileHeight)]) {
					if(direction == kDirection_Forward) {
						objectOne.origin = CGPointMake(objectOne.origin.x - speed.x * delta, objectOne.origin.y - speed.y * delta);
					} else if(direction == kDirection_Backwards) {
						objectOne.origin = CGPointMake(objectOne.origin.x + speed.x * delta, objectOne.origin.y + speed.y * delta);
					}
				}
			}
			tileX++;
		}
		tileY++;
		tileX = 0;
	}
}
</pre>
<p>This isn&#8217;t how i normally do this but i dont really care about doing anything else but stoping the object from going through that layer. Normally i return a yes or no and then i do what i what (that works).  I&#8217;ve also tried getting info from the xml file without much success.  I also made changes to the image class and tiledmap class to support what i&#8217;m doing for example origin and the layers array.  These changes work and i&#8217;ve tried them multiple ways and it works but it keeps coming back to this method.  No errors are given to me on build so if there is a  ; missing or something its not that it was my copy and paste error.</p>
<p>Hope you can help mike and thanks for the great work you already been doing</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mike</title>
		<link>http://www.71squared.com/2009/05/3d-sound/comment-page-1/#comment-846</link>
		<dc:creator>mike</dc:creator>
		<pubDate>Thu, 04 Jun 2009 14:44:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.71squared.co.uk/?p=567#comment-846</guid>
		<description>I&#039;ve managed to work out why the volume was dropping off so quickly as well now.  There are a number of settings which can define the type of operation you want to use for distance attenuation.  I&#039;ve not investigated them all yet, but you can add the following line of code to set a reference distance for a sound source and control how quickly the volume drops off as the sound source moves away from the listener.
&lt;pre&gt;
alSourcef(sourceID, AL_REFERENCE_DISTNACE, 50.0f);
&lt;/pre&gt;
If you play with the value you will see how it effects the volume drop off.

From the documentation it would seem that for most needs in a 2D game the linear distance rolloff model would seem to be valid.  This is where the volume drops off in a linear manner based on the distance from the source to the listener.

The command to set the model you want to use is
&lt;pre&gt;
alDistanceModel(ALenum modelName);
&lt;/pre&gt;

Possible model names are:
&lt;pre&gt;
AL_NONE
AL_INVERSE_DISTANCE
AL_INVERSE_DISTANCE_CLAMPED
AL_LINEAR_DISTANCE
AL_LINEAR_DISTANCE_CLAMPED
AL_EXPONENT_DISTANCE
AL_EXPONENT_DISTANCE_CLAMPED
&lt;/pre&gt;

There are also other options that can be set such as
&lt;pre&gt;
AL_MAX_DISTANCE
&lt;/pre&gt;
which can be used to help tune the OpenAL model to your needs.

I&#039;m making changes to the SoundManager at the moment and I&#039;ll post the changes.  The documentation at the following location has of course been useful ;o)

http://connect.creativelabs.com/openal/Documentation/OpenAL%201.1%20Specification.pdf

Mike</description>
		<content:encoded><![CDATA[<p>I&#8217;ve managed to work out why the volume was dropping off so quickly as well now.  There are a number of settings which can define the type of operation you want to use for distance attenuation.  I&#8217;ve not investigated them all yet, but you can add the following line of code to set a reference distance for a sound source and control how quickly the volume drops off as the sound source moves away from the listener.</p>
<pre>
alSourcef(sourceID, AL_REFERENCE_DISTNACE, 50.0f);
</pre>
<p>If you play with the value you will see how it effects the volume drop off.</p>
<p>From the documentation it would seem that for most needs in a 2D game the linear distance rolloff model would seem to be valid.  This is where the volume drops off in a linear manner based on the distance from the source to the listener.</p>
<p>The command to set the model you want to use is</p>
<pre>
alDistanceModel(ALenum modelName);
</pre>
<p>Possible model names are:</p>
<pre>
AL_NONE
AL_INVERSE_DISTANCE
AL_INVERSE_DISTANCE_CLAMPED
AL_LINEAR_DISTANCE
AL_LINEAR_DISTANCE_CLAMPED
AL_EXPONENT_DISTANCE
AL_EXPONENT_DISTANCE_CLAMPED
</pre>
<p>There are also other options that can be set such as</p>
<pre>
AL_MAX_DISTANCE
</pre>
<p>which can be used to help tune the OpenAL model to your needs.</p>
<p>I&#8217;m making changes to the SoundManager at the moment and I&#8217;ll post the changes.  The documentation at the following location has of course been useful ;o)</p>
<p><a href="http://connect.creativelabs.com/openal/Documentation/OpenAL%201.1%20Specification.pdf" rel="nofollow">http://connect.creativelabs.co.....cation.pdf</a></p>
<p>Mike</p>
]]></content:encoded>
	</item>
</channel>
</rss>
