<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Braindump &#187; Objective-C</title>
	<atom:link href="http://www.braindump.ch/tag/objective-c/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.braindump.ch</link>
	<description>(engl.; deutsch: Hirnauszug, „Gedächtnisprotokoll“, „das was hängengeblieben ist“)</description>
	<lastBuildDate>Mon, 02 Jan 2012 10:54:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Tadaaaa! Sound abspielen in Cocoa/Objective-C</title>
		<link>http://www.braindump.ch/2008/07/12/tadaaaa-sound-abspielen-in-cocoaobjective-c/</link>
		<comments>http://www.braindump.ch/2008/07/12/tadaaaa-sound-abspielen-in-cocoaobjective-c/#comments</comments>
		<pubDate>Sat, 12 Jul 2008 16:24:41 +0000</pubDate>
		<dc:creator>Markus Graf</dc:creator>
				<category><![CDATA[Apple Software]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[programmierung]]></category>

		<guid isPermaLink="false">http://blog.markusgraf.ch/?p=172</guid>
		<description><![CDATA[Hier eine Beispiel-Implementation einer Methode, die eine Sound-Datei abspielen soll. Der Typ der Datei ist dabei relativ egal, sie muss von Apple einfach unterstützt werden. - (void) playAlertSound:(id)soundFile{ NSSound *sound = [[NSSound alloc] initWithContentsOfFile:soundFile byReference: YES]; [sound play]; } Nun können wir die Methode überall relativ simpel aufrufen: [self playAlertSound:[NSString stringWithFormat:@"%@/authoriz.mp3", [[NSBundle mainBundle] resourcePath]]]; [[NSBundle [...]]]></description>
			<content:encoded><![CDATA[<p>Hier eine Beispiel-Implementation einer Methode, die eine Sound-Datei abspielen soll. Der Typ der Datei ist dabei relativ egal, sie muss von Apple einfach unterstützt werden.</p>
<pre>
- (void) playAlertSound:(id)soundFile{
   NSSound *sound = [[NSSound alloc]
                      initWithContentsOfFile:soundFile
                      byReference: YES];
    [sound play];
}
</pre>
<p>Nun können wir die Methode überall relativ simpel aufrufen:</p>
<pre>
[self playAlertSound:[NSString stringWithFormat:@"%@/authoriz.mp3",
[[NSBundle mainBundle] resourcePath]]];
</pre>
<p>[[NSBundle mainBundle] resourcePath]] bezeichnet hierbei den Pfad zum Resourcen-Ordner der Applikation. Der Aufruf kann aber auch mit irgend einer externen Datei gemacht werden:</p>
<pre>
[self playAlertSound:@"/Users/Christoph_Blocher/MyMusic/NationalHymne.mp3"];
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.braindump.ch/2008/07/12/tadaaaa-sound-abspielen-in-cocoaobjective-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

