BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

waveOut CALLBACK question

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Multimedia
View previous topic :: View next topic  
Author Message
jh
Guest





PostPosted: Sat Oct 22, 2005 10:36 pm    Post subject: waveOut CALLBACK question Reply with quote



Hi,

I'm using Delphi 2005 Pro. I have found very few examples of using low level
API for wave in/out. I can play or record audio data but still have some
problems with reseting devices or playing with different cards sometimes
hangs my application.

1.
waveOutOpen uses callback with CALLBACK_WINDOW/FUNCTION/THREAD/EVENT. What
are advantages of using these callbacks? I mean when e.g. CALLBACK_FUNCTION
could be a better way than using CALLBACK_WINDOW? Callback window needs
handle. OK, even when I'm creating my own class based on TObject I can get
handle. And in most cases it works. CALLBACK_FUNCTION. With my onboard card
it "almost" works, with my pro RME audio card it doesn't. Almost, because
waveOutReset hangs the application, while waveOutPrepareHeader and
waveOutWrite doesn't. MS SDK that it's not allowed using any waveOut
function from callback function. OK. It looks that I can only post a message
within waveOutProc. So finally it looks like CALLBACK_WINDOW... So where's
the difference?

2. CALLBACK_EVENT and CALLBACK_THREAD. I haven't found any example... How
should I use it?

BTW. How can I play 24 bit wave files? I mean 24-bit stream, no 24 bit
reduced to 16 bit like many players do....

thanks,
Jacek

Back to top
Jens Gruschel
Guest





PostPosted: Sun Oct 23, 2005 12:04 pm    Post subject: Re: waveOut CALLBACK question Reply with quote



Quote:
I'm using Delphi 2005 Pro. I have found very few examples of using low
level API for wave in/out. I can play or record audio data but still
have some problems with reseting devices or playing with different cards
sometimes hangs my application.

I'm using waveOut... and a callback window without any problems. Could
you provide some code? (I've posted some code of mine to the attachment
newsgroup).

Quote:
BTW. How can I play 24 bit wave files? I mean 24-bit stream, no 24 bit
reduced to 16 bit like many players do....

Haven't tried it, but should be possible, if you sound card does support
it. You can use waveOutOpen with WAVE_FORMAT_QUERY to see whether some
format is supported by a device (and it should be possible to enumerate
all formats, although I don't remember how exactly this is done).

Jens

--
Jens Gruschel
http://www.pegtop.net

Back to top
alanglloyd@aol.com
Guest





PostPosted: Mon Oct 24, 2005 9:13 am    Post subject: Re: waveOut CALLBACK question Reply with quote



Quote:
Almost, because
waveOutReset hangs the application, while
waveOutPrepareHeader and
waveOutWrite doesn't.

I know there is a stated limitaion to what you may call in a callback
function in waveOut. But there is also another gotcha.

waveOutReset stops the wave recording, _but_ returns all the buffers
immediately with a done flag. Therefore your code handling the buffers
must still be active until all the buffers have been returned.

I found that in order to stop AVs I had to count the buffers in the
queue and only call waveOutClose after the queue was empty.

waveInStop has similar gotchas.

I have an example in Delphi of using CALLBACK_EVENT. If that is any use
to you, email me and I will send it.

Alan Lloyd


Back to top
Thaddy
Guest





PostPosted: Mon Oct 24, 2005 4:21 pm    Post subject: Re: waveOut CALLBACK question Reply with quote

Quote:

BTW. How can I play 24 bit wave files? I mean 24-bit stream, no 24 bit
reduced to 16 bit like many players do....

Try waveioX.pas available as freeware from http://www.tobybear.de
This file is an extension of Carlos Barbosa's WaveIo, but supports all
known wave formats including 24, 32 and 64 bit integer and 32 bit
floating point.

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.