Re: OpenGL Vertical Syncing effect on run loops

2015-09-23 Thread Michael David Crawford
My Warp Life implementation of Conway's Game of Life updates its model
- a square grid of bits - up to 8,000 times per second, but
invalidates the display with a display link.  It works really well and
results in a frame rate far faster than the refresh rate but with
smooth animation.

I was puzzled that my App was getting only one-tenth of the available
CPU.  This turned out to be due to my early code invalidating the
display every generation.  I operated the life generation update on a
separate thread but invalidated the display on the main - GUI -
thread.  Ninety percent of my CPU was devoted to back and forth
context switches that did no other work of any sort.

My current use of the display link resulted in a tenfold increase in
performance.
Michael David Crawford P.E., Consulting Process Architect
mdcrawf...@gmail.com
http://mike.soggywizard.com/

  One Must Not Trifle With Wizards For It Makes Us Soggy And Hard To Light.


On Tue, Sep 22, 2015 at 7:51 PM, Greg Parker  wrote:
>
>> On Sep 22, 2015, at 6:56 PM, Jerry Krinock  wrote:
>>
>> In Apple document QA1385, in Listing 2, describing how to drive OpenGL 
>> Rendering Loops 10 years ago, an NSTimer, repeating every 1 millisecond, is 
>> added to an app’s run loop [1].
>
> Just to be clear: don't do that. Use CVDisplayLink.
>
>
>> Referring to this timer, the text says that:
>>
>> "When vertical synchronization is enabled in your OpenGL application, during 
>> each retrace period, when the timer fires, …”
>>
>> H, a timer with time interval of 1 millisecond is now going to fire 
>> during each retrace period, 16.7 milliseconds or so!  This implies that when 
>> vertical synchronization is enabled in an OpenGL application, the 
>> application’s run loop, in all modes, is synchronized to the video frame and 
>> can go no faster.  Is this correct?
>
> It is not. The timer would fire multiple times per retrace if it were 
> unhindered. But at some point the timer callback will provoke an OpenGL 
> buffer swap, and that will block until the next retrace when vertical 
> synchronization is enabled. The gated buffer swap inside the timer callback 
> is the rate-limiting factor, not anything in the runloop or NSTimer itself.
>
>
> --
> Greg Parker gpar...@apple.com Runtime Wrangler
>
>
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/mdcrawford%40gmail.com
>
> This email sent to mdcrawf...@gmail.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Toolbar Template Image help

2015-09-23 Thread Jens Alfke

> On Sep 23, 2015, at 1:31 AM, Costas Chatzinikolas 
>  wrote:
> 
> Hi everyone.
> 
> I want to design my toolbar icon images for my segmented control and i want
> to start from somewhere.

It sounds like you’re looking for an image of the background of the segmented 
control? You don’t need that. Instead, instantiate an NSSegmentedControl, add 
your item icons to it, add the view to an NSToolbarItem, and add that item to 
your toolbar.

—Jens


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Toolbar Template Image help

2015-09-23 Thread Lee Ann Rucker
A template image is just one that’s designed according to specific rules and 
has a name ending in “Template” or the isTemplate flag set:

https://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/OSXHIGuidelines/ToolbarIcons.html#//apple_ref/doc/uid/2957-CH89-SW1

Any black and white image can be used as a template image. There’s also a large 
number of system-provided ones - anything defined by NSImageName*Template

On Sep 23, 2015, at 1:31 AM, Costas Chatzinikolas 
 wrote:

> Hi everyone.
> 
> I want to design my toolbar icon images for my segmented control and i want
> to start from somewhere.
> Does any of you have a template image for a toolbar icon to share? I did a
> lot of search but i could not find a template to download.
> 
> 
> I am using XCode 7 in Yosemite.
> 
> Thanks a lot.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: swift: windowControllerDidLoadNib called twice

2015-09-23 Thread Boyd Collier
Thanks, Quincey, for taking the trouble to respond.  I’m pleased to say that 
after far too many hours of going over the details of my code (and having to 
make a trip to our local Apple store to get my “magic mouse” replaced), it is 
now working correctly.   I’ve been writing code for Macs off-and-on for 30 
years, and once again I conclude that dogged persistence is an essential 
attribute.  Undoubtedly, you know that, but I mention it for any newbs who 
might read this. 
 
Boyd


> On Sep 18, 2015, at 6:02 PM, Quincey Morris 
>  wrote:
> 
> On Sep 18, 2015, at 16:40 , Boyd Collier  > wrote:
>> 
>> Any suggestions why this might be happening would be greatly appreciated.
> 
> You should approach this systematically.
> 
> 1. Is your app actually creating 2 window controllers? You can look at the 
> object pointer in the debugger, and see if you had different objects each 
> time.
> 
> If there are multiple objects being created, are they being created serially 
> (one being disposed of before the other is created), or in parallel (both 
> created simultaneously)?
> 
> 2. Is your app creating 2 documents?
> 
> 3. If there is only 1 window controller object, you can start looking at 
> various pieces of nib-loading API (e.g. windowDidLoad, viewDidLoad, that sort 
> of thing) to find out you’re instantiating a nib twice, or triggering the 
> same machinery twice in the loading of a single nib.
> 
> Also, keep in mind that it’s not impossible that Cocoa is creating an extra 
> document or window controller for its own purposes (e.g. as part of state 
> restoration, or file versioning, or something newer like handoff). This 
> *might* be the price of doing business, or it *might* indicate a problem in a 
> different area of your app that it’s not obvious you should look at.
> 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Toolbar Template Image help

2015-09-23 Thread Costas Chatzinikolas
Hi everyone.

I want to design my toolbar icon images for my segmented control and i want
to start from somewhere.
Does any of you have a template image for a toolbar icon to share? I did a
lot of search but i could not find a template to download.


I am using XCode 7 in Yosemite.

Thanks a lot.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Beep ( duration, frequency )

2015-09-23 Thread Jens Alfke

> On Sep 23, 2015, at 8:11 PM, Raglan T. Tiger  wrote:
> 
> After I frustrated myself I realized your recommendation.  Now I want to make 
> arbitrary sounds (am I a recording engineer to?) to use with +soundNAMED so 
> any suggestions while I Alphabet?

For general sound recording or making synthesized sounds, GarageBand is pretty 
good and free.

PureData  is a visual language for audio processing 
that’s pretty widely used. I haven’t tried it myself, but it should let you 
plug together modules to create all sorts of sounds, including square waves if 
that’s what turns you on.

BTW, NSSound is rather limited. The next step up for playing sound files would 
be AVPlayer in the AVFoundation framework.

The Cocoa programming blog/magazine objc.io had an issue on audio earlier this 
year that would probably interest you: 

—Jens
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

[ALERT:Possible Phishing] Re: Beep ( duration, frequency )

2015-09-23 Thread dangerwillrobinsondanger
There is also AVAudioEngine added in Yosemite. 
It's a higher level Objective-C API around Core Audio. 
The docs still kind of don't tell you much and at times the API makes more 
sense if you know a little about Core Audio but the friction is a lot less C 
level. 

The Amazing Audio Engine is a fairly mature open source framework that provides 
similarly high level abstraction with decent docs. 

Don't sell any of it short. Worthy additions to a skill set. The truth is 
there's a lot you do need to know to do audio. Just like video or databases or 
networking or almost anything. 
But somebody might have already written a simpler convenience wrapper. 
Unfortunately commercial games and AV apps usually don't open source a lot. 

Sent from my iPhone

> On Sep 24, 2015, at 12:46 PM, Jens Alfke  wrote:
> 
> 
>> On Sep 23, 2015, at 8:11 PM, Raglan T. Tiger  wrote:
>> 
>> After I frustrated myself I realized your recommendation.  Now I want to 
>> make arbitrary sounds (am I a recording engineer to?) to use with 
>> +soundNAMED so any suggestions while I Alphabet?
> 
> For general sound recording or making synthesized sounds, GarageBand is 
> pretty good and free.
> 
> PureData 
>   > is a visual language for audio processing that’s pretty widely used. I 
> haven’t tried it myself, but it should let you plug together modules to 
> create all sorts of sounds, including square waves if that’s what turns you 
> on.
> 
> BTW, NSSound is rather limited. The next step up for playing sound files 
> would be AVPlayer in the AVFoundation framework.
> 
> The Cocoa programming blog/magazine objc.io had an issue on audio earlier 
> this year that would probably interest you: 
>   >
> 
> ―Jens
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/dangerwillrobinsondanger%40gmail.com
> 
> This email sent to dangerwillrobinsondan...@gmail.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: [ALERT:Possible Phishing] Beep ( duration, frequency )

2015-09-23 Thread Raglan T. Tiger

I found that Glass, Ping  and Pop are real close to the Windows frequencies 
used.  

Mark it implemented.

-rags
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Beep ( duration, frequency )

2015-09-23 Thread Jens Alfke

> On Sep 23, 2015, at 9:05 PM, dangerwillrobinsondan...@gmail.com wrote:
> 
> There is also AVAudioEngine added in Yosemite. 
> It's a higher level Objective-C API around Core Audio. 
> The docs still kind of don't tell you much and at times the API makes more 
> sense if you know a little about Core Audio but the friction is a lot less C 
> level. 

Nice! I hadn’t heard of this before. It looks equivalent to the AUGraph API but 
much easier to use.

Rags, if you want to generate and play waveforms, it looks like you’d create an 
AVAudioPCMBuffer, fill it with audio samples (like series of 0, 0, 0, 1, 1, 1, 
… for a square wave), then connect that to an AVAudioPlayerNode and that to an 
AVAudioMixerNode.

> The truth is there's a lot you do need to know to do audio. Just like video 
> or databases or networking or almost anything. 

I’ve found audio to be one of the hardest areas to program to, partly because 
the data formats are complex and partly because a lot of stuff needs to run in 
real-time, but mostly because the APIs have been very difficult to use. Apple’s 
been doing a great job with AVFoundation; I just hope they find the time to 
document the newer parts properly.

—Jens
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Beep ( duration, frequency )

2015-09-23 Thread Charles Srstka
> On Sep 23, 2015, at 7:40 PM, Jens Alfke  wrote:
> 
>> On Sep 23, 2015, at 4:41 PM, Raglan T. Tiger > > wrote:
>> 
>> I want code that is this simple on Windows:
>> 
>> DWORD freq = 587;
>> if(!something) freq = 659;
>> if(another) freq = 523;
>> Beep(freq, 150);
> 
> No, there’s no simple API for this. This API in Windows is a relic of the 
> early PC days when getting any kind of audio out was amazing, even if it was 
> crap square-waves. I remember demos on the Apple II that would use APIs like 
> this to play “Happy Birthday” or something. 
> 
> (It’s kind of like you’re asking “where’s the Cocoa API to fill the whole 
> screen with red”.)

The original Mac had an API just like that, actually, way back in the 80s. It 
stopped working sometime in the 90s, though; I think the original 
black-and-white models actually had a separate piece of hardware for generating 
waveforms, and they stopped including it somewhere in the 68020/68030 era. 
Pretty annoying as a kid when the family computer got upgraded and suddenly the 
sound on my games wouldn’t play anymore. :-)

Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Beep ( duration, frequency )

2015-09-23 Thread Raglan T. Tiger

-rags



> On Sep 23, 2015, at 7:18 PM, k...@hh.iij4u.or.jp wrote:
> 
> If you want to use different sounds for some alerts or notifications, you can 
> use sytem provided sounds, such as "Basso", "Frog", "Submarine", etc.
> 
>  NSSound *sound = [NSSound soundNamed:@"Submarine"];
>  [sound play];
> 

After I frustrated myself I realized your recommendation.  Now I want to make 
arbitrary sounds (am I a recording engineer to?) to use with +soundNAMED so any 
suggestions while I Alphabet?

-rags

0  1 
 2 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Beep ( duration, frequency )

2015-09-23 Thread Kaydell Leavitt

> On Sep 23, 2015, at 5:31 PM, Richard Charles  wrote:
> 
> 
>> On Sep 23, 2015, at 5:13 PM, Raglan T. Tiger  wrote:
>> 
>> Windows has a Beep function:
>> 
>> BOOL WINAPI Beep(
>> _In_ DWORD dwFreq,
>> _In_ DWORD dwDuration
>> );
>> 
>> Is there anything this easy for OS X?
> 
> void NSBeep (void);
> 
> This is a standard system alert. The term “beep” implies an alert, meaning 
> that developers do not get to choose the frequency and duration on Apple 
> platforms.
> 
> The windows function seems to be misnamed. It should be Tone or Sound or 
> something like that.
> 
> --Richard Charles

OP,

You could create a sound and play it with NSSound.  The sound can be the 
frequency and duration that you want it to be, though you’d have to create the 
sound, such as a .wav file to play it with an NSSound object.

— Kaydell

> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/kaydell%40yahoo.com
> 
> This email sent to kayd...@yahoo.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Beep ( duration, frequency )

2015-09-23 Thread Jens Alfke

> On Sep 23, 2015, at 4:13 PM, Raglan T. Tiger  wrote:
> 
> Is there anything this easy for OS X?

Well, NSBeep() is pretty easy if you just want to play a sound to alert the 
user.

There’s no simple way to play ugly-sounding poorly-timed square waves, like the 
Windows Beep function. You’d need to use CoreAudio or CoreMIDI. What is it 
you’re trying to do?

—Jens
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Beep ( duration, frequency )

2015-09-23 Thread Richard Charles

> On Sep 23, 2015, at 5:13 PM, Raglan T. Tiger  wrote:
> 
> Windows has a Beep function:
> 
> BOOL WINAPI Beep(
>  _In_ DWORD dwFreq,
>  _In_ DWORD dwDuration
> );
> 
> Is there anything this easy for OS X?

void NSBeep (void);

This is a standard system alert. The term “beep” implies an alert, meaning that 
developers do not get to choose the frequency and duration on Apple platforms.

The windows function seems to be misnamed. It should be Tone or Sound or 
something like that.

--Richard Charles


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Beep ( duration, frequency )

2015-09-23 Thread Raglan T. Tiger


> On Sep 23, 2015, at 5:30 PM, Jens Alfke  wrote:
> 
> What is it you’re trying to do?


I want code that is this simple on Windows:

DWORD freq = 587;
if(!something) freq = 659;
if(another) freq = 523;
Beep(freq, 150);
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Beep ( duration, frequency )

2015-09-23 Thread Ed Wynne

On Sep 23, 2015, at 7:41 PM, Raglan T. Tiger  wrote:

> 
> 
>> On Sep 23, 2015, at 5:30 PM, Jens Alfke  wrote:
>> 
>> What is it you’re trying to do?
> 
> I want code that is this simple on Windows:
> 
> DWORD freq = 587;
> if(!something) freq = 659;
> if(another) freq = 523;
> Beep(freq, 150);

OS X does not have a built-in API that provides such a service.

That said, synthesizing beep-like-waveforms isn’t very hard. You should ask 
google, or stack overflow.

-Ed


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Beep ( duration, frequency )

2015-09-23 Thread Raglan T. Tiger
Windows has a Beep function:

BOOL WINAPI Beep(
  _In_ DWORD dwFreq,
  _In_ DWORD dwDuration
);

Is there anything this easy for OS X?

-rags
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Beep ( duration, frequency )

2015-09-23 Thread Raglan T. Tiger

-rags



> On Sep 23, 2015, at 5:49 PM, Ed Wynne  wrote:
> 
> That said, synthesizing beep-like-waveforms isn’t very hard. You should ask 
> google, or stack overflow.

Well I have googled and see many more  lines of code that the simple windows 
Beep ... PIA

-rags
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Beep ( duration, frequency )

2015-09-23 Thread Quincey Morris
On Sep 23, 2015, at 17:40 , Jens Alfke  wrote:
> 
> No, there’s no simple API for this.

There’s a simple way to play an arbitrary finite-length sound (AVAudioPlayer). 
All you need is a sound file (or a couple of sound files) that can easily be 
created in an audio editor. It’s only 2 lines to play such a file — maybe only 
one, if there’s a convenience method.

This has the advantage that the sound can be tailored to the intended use. If 
you want alert “beeps” of various pitches, you can customize the sound files so 
they don’t start and stop abruptly. If you want a pure sine wave, you can do 
that.

That’s why I wish Rags had answered your earlier “what are you trying to do?” 
question with a bit less snark. If we actually knew the answer, we could likely 
give more useful advice.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Beep ( duration, frequency )

2015-09-23 Thread Jens Alfke

> On Sep 23, 2015, at 4:41 PM, Raglan T. Tiger  wrote:
> 
> I want code that is this simple on Windows:
> 
> DWORD freq = 587;
> if(!something) freq = 659;
> if(another) freq = 523;
> Beep(freq, 150);

No, there’s no simple API for this. This API in Windows is a relic of the early 
PC days when getting any kind of audio out was amazing, even if it was crap 
square-waves. I remember demos on the Apple II that would use APIs like this to 
play “Happy Birthday” or something. 

(It’s kind of like you’re asking “where’s the Cocoa API to fill the whole 
screen with red”.)

Nowadays, if you want to write code to create audio, people’s expectations are 
a bit higher :) and the APIs are correspondingly more complex. OS X is the 
premier pro audio platform so it’s been designed to do serious audio really 
well. But the APIs aren’t easy to learn.

If you want to fool around and write a bit of code to play a tune for fun, I 
think CoreMIDI might not be too hard. The good thing is there’s a full set of 
General MIDI instruments built into the OS, so you can play the tune on a 
decent sounding piano or organ or whatever.

There are also 3rd party cross-platform APIs for “trackers” that do really high 
level stuff where you just create a file describing a few notes and they take 
care of the rest. I’m not familiar with the details, though.

—Jens
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Beep ( duration, frequency )

2015-09-23 Thread kata
> Windows has a Beep function:
> 
> BOOL WINAPI Beep(
>  _In_ DWORD dwFreq,
>  _In_ DWORD dwDuration
> );
> 
> Is there anything this easy for OS X?

 If you want to use different sounds for some alerts or notifications, you can 
use sytem provided sounds, such as "Basso", "Frog", "Submarine", etc.

  NSSound *sound = [NSSound soundNamed:@"Submarine"];
  [sound play];

Yoshiaki Katayanagi
http://www.jizoh.jp/english.html


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com