Okay, I’ve updated the SDL audio recording patch to be both source and
binary compatible with vanilla SDL 1.2. In order to do this, I had to
make the API for recording different than in my original recording
patch. So here’s how you use the new API:
Before you pass your audio spec to SDL_OpenAudio(), you should abuse the
bits in the format field as follows:
Set AUDIO_INPUT (now defined in SDL_audio.h) to enable recording. Set
AUDIO_OUTPUT (also defined in SDL_audio.h) to enable playback. If you
set neither bit, which is what all current SDL programs do, then only
playback is enabled. Examples:
Then you just set your single callback as in a normal SDL program. SDL
puts any recorded data in the stream buffer for your callback to use.
And then any data you want to play should be stored in that same stream
buffer by the time the callback returns.
Thanks to David Olofson for the idea of the new backwards-compatible
API. Feedback is definitely welcome.–
Dan Helfman
Jim Henson’s Creature Shop
-------------- next part --------------
A non-text attachment was scrubbed…
Name: SDL-1.2-record.diff.gz
Type: application/x-gzip
Size: 5620 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20020416/a777e408/attachment.bin
Exception: EXC_BAD_ACCESS (0x0001)
Codes: KERN_INVALID_ADDRESS (0x0001) at 0x7848001a
Thread 0 Crashed: #0 0x706bab68 in objc_msgSend #1 0x30053254 in QZ_SetCaption #2 0x30048838 in SDL_WM_SetCaption #3 0x0000496c in SDL_main #4 0x0000454c in -[SDLMain applicationDidFinishLaunching:]
Warning: when run in the debugger (only), the monitor remains black
after this crash. I have to kill gdb remotely to recover the screen.
In fact, you could just return from the callback doing nothing, as the
data is already in place.
//David Olofson — Programmer, Reologica Instruments AB
.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia | ----------------------------> http://www.linuxdj.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |-------------------------------------> http://olofson.net -'On Wednesday 17 April 2002 00:47, James wrote:
On Tue, Apr 16, 2002 at 03:13:57PM -0700, Dan Helfman wrote:
| Feedback is definitely welcome.
In that case, just loop a wire from your soundcard’s input to its
output and put the received data back when the callback returns.
I’m applying the fix. Out of curiousity, does that mean that OpenGL
MacOS X windows in SDL can’t have their caption set?
No. For both OpenGL and 2D, there is a window on the screen - the
difference lies in the window’s view. The OpenGL layer in Mac OS X can’t
create a window for us, we have to bind a context to a window.
-DOn Wednesday, April 17, 2002, at 09:25 AM, Sam Lantinga wrote:
Also there is a typo on SDLMain.m vs the SDLMain.nib:
The quit action in the .m file is:
terminate: in SDLApplication
in the nib file the quit item is connected to:
quit: of SDLMain.
The SDLMain class in SDLMain.m has to quit method and it’s not the
app delegate. So the quit item is disabled in a brand new SDL app.
So i moved terminate stuff to the same thing called “quit” in the
SDLMain class:
(void)quit:(id)sender
{
/* Post a SDL_QUIT event */
SDL_Event event;
event.type = SDL_QUIT;
SDL_PushEvent(&event);
}
Does the application exit after the quit method is called? The app should
not quit until the SDL event loop gets the SDL_QUIT, which it can ignore
or return from the app’s event loop to quit the app.
I believe the terminate method can tell the caller whether or not the app
acknowledged the quit, which is what we want.
Can you instead bind the quit menu to the terminate method of SDLMain in
the nib file?
At 11:28 AM -0500 4/17/02, Darrell Walisser wrote:
Does the application exit after the quit method is called? The app should
not quit until the SDL event loop gets the SDL_QUIT, which it can ignore
or return from the app’s event loop to quit the app.
With my change it works fine with the OpenGL test app. Without my
change the quit item is disabled, because its action doesn’t exist. I
don’t think you want that… Something is wrong, quit item should be
enabled for the samples.
I believe the terminate method can tell the caller whether or not the app
acknowledged the quit, which is what we want.
Can you instead bind the quit menu to the terminate method of SDLMain in
the nib file?
SDLMain doesn’t have a terminate method. The terminate method is on
SDLApplication.
I tried giving it one (in IB only, not adding it to the m file) but
the menu item is disabled because Cocoa knows SDLMain doesn’t really
have the method.
Basically the quit item in the nib file is connected to an action in
SDLMain class that doesn’t exist. (“quit”)
I’m not sure what all the poseasclass business is about. Just adding
the quit method to SDLMain works.