intfiction.org

The Interactive Fiction Community Forum
It is currently Fri May 24, 2013 11:35 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 63 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7  Next
Author Message
 Post subject: Re: Glk sound API plans
PostPosted: Thu Jun 09, 2011 12:16 pm 
Offline

Joined: Tue Apr 27, 2010 1:02 pm
Posts: 797
I shied away from the NSPipe method early in development and I forget exactly why. I recall reading some scattered reports online that NSPipes had a relatively low lifetime data limit - some tens of MB before they get clogged. I switched to Distributed Objects for moving data around, in much the same way cocoaglk does it except not as well engineered.

I took another crack at CFRunLoop last night, and learned it's safe to send Mach messages inside a signal handler (!!). So CFRunLoop can listen on a Mach port and wake up when it sees the message. Now everything works great - hardware sleep, lower CPU when idle - except timers, which is convenient since I have to rewrite that code anyhow.


Top
 Profile Send private message  
 
 Post subject: Re: Glk sound API plans
PostPosted: Thu Jun 09, 2011 4:52 pm 
Offline

Joined: Sat Jan 23, 2010 4:56 pm
Posts: 2086
The only discussions I see about NSPipe look like buffer size problems, not lifetime transfer problems. (Or people who are failing to read their buffers.) But if your plan works, great. :)

I am going to take this as a signal to go ahead and write up the sound API proposal.


Top
 Profile Send private message  
 
 Post subject: Re: Glk sound API plans
PostPosted: Thu Jun 09, 2011 5:04 pm 
Offline

Joined: Tue Apr 27, 2010 1:02 pm
Posts: 797
Write away. :)


Top
 Profile Send private message  
 
 Post subject: Re: Glk sound API plans
PostPosted: Fri Jun 10, 2011 12:29 am 
Offline

Joined: Sat Jan 23, 2010 4:56 pm
Posts: 2086
The draft chapter is posted:

https://github.com/erkyrath/glk-dev/wik ... ec-changes

Please let me know what I got wrong. :)


Top
 Profile Send private message  
 
 Post subject: Re: Glk sound API plans
PostPosted: Sun Jun 12, 2011 11:33 am 
Offline

Joined: Sat Jan 23, 2010 4:56 pm
Posts: 2086
Well, I got one obvious thing wrong: the glk_schannel_play_multi() call has no way to start the two sounds on two different channels, which makes it pointless.

For technical reasons, the only practical way to define this capability is to say:

glui32 glk_schannel_play_multi(schanid_t *chanarray, glui32 chancount, glui32 *sndarray, glui32 soundcount, glui32 notify);

...and require that the channel and sound arrays be the same length. Does that seem sufficiently sane?

I also left in some new gestalt selectors from an earlier draft. gestalt_Sound2 is the only new selector in this proposal.


Top
 Profile Send private message  
 
 Post subject: Re: Glk sound API plans
PostPosted: Sun Jun 12, 2011 12:14 pm 
Offline

Joined: Sun Jun 20, 2010 7:18 am
Posts: 14
zarf wrote:
glui32 glk_schannel_play_multi(schanid_t *chanarray, glui32 chancount, glui32 *sndarray, glui32 soundcount, glui32 notify);


Can you just say that sounds do not start immediately when requested, but are queued up and all start simultaneously at the next glk_select call?


Top
 Profile Send private message  
 
 Post subject: Re: Glk sound API plans
PostPosted: Sun Jun 12, 2011 11:58 pm 
Offline

Joined: Sat Jan 23, 2010 4:56 pm
Posts: 2086
Well, that's a not entirely unelegant solution. :)

What do people think?

Would we want to queue other sound commands as well? (Volume changes, stops, pauses...)


Top
 Profile Send private message  
 
 Post subject: Re: Glk sound API plans
PostPosted: Mon Jun 13, 2011 12:33 am 
Offline

Joined: Mon Jun 29, 2009 5:51 am
Posts: 288
zarf wrote:
Well, that's a not entirely unelegant solution. :)

What do people think?

Would we want to queue other sound commands as well? (Volume changes, stops, pauses...)
It seems a slightly arbitrary rule to introduce. Given that we're introducing pause and unpause calls, would it perhaps be better to have calls to pause and unpause several channels at once? These could then be the only calls that operate on multiple channels. If you want multiple sounds to start all together, create the channels, pause them, play sounds on them, then unpause them all together. This would require that the spec make it explicit that playing a sound on a paused channel sets it up ready to go but doesn't unpause, though.


Top
 Profile Send private message  
 
 Post subject: Re: Glk sound API plans
PostPosted: Tue Jun 14, 2011 12:43 pm 
Offline

Joined: Sat Jan 23, 2010 4:56 pm
Posts: 2086
Quote:
Given that we're introducing pause and unpause calls, would it perhaps be better to have calls to pause and unpause several channels at once?


That would work too.

However, I'm looking at the OSX/iOS audio toolbox API, and it doesn't have a synchronized pause call. (There's an "unpause at a given time" call, but using that to do synchronized unpauses would require a bit of guesswork.) So I suspect that the Mac/iOS implementation of this stuff will fall more naturally into a synchronized-play model, where the app code synchronizes its decoding of sound data to the audio queue rather than pausing the audio queue itself.

Possibly I'm overthinking this, since I haven't looked at how the current Mac libraries do it. :)


Top
 Profile Send private message  
 
 Post subject: Re: Glk sound API plans
PostPosted: Sun Jun 19, 2011 12:41 am 
Offline

Joined: Sat Jan 23, 2010 4:56 pm
Posts: 2086
Nobody appears to be enthusiastic about these variations, so I'm sticking with my original proposal (plus the correction I added above).


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 63 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7  Next

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group