I want to play one .wav file, then play another when it's finished (a
spelling word and a sentence). But I want the user to be able to type while hearing the word and sentence. Here's my attempt: [(Sound fromFile: 'word'.wav') woofAndWait. (Sound fromFile: 'sentence'.wav') woof] fork The fork doesn't seem to be happening, or at least the woofAndWait is making the whole program wait. Can anyone suggest a way to accomplish this? |
Mark,
"Mark Wilden" <[hidden email]> wrote in message news:[hidden email]... > I want to play one .wav file, then play another when it's finished (a > spelling word and a sentence). But I want the user to be able to type while > hearing the word and sentence. > > Here's my attempt: > > [(Sound fromFile: 'word'.wav') woofAndWait. > (Sound fromFile: 'sentence'.wav') woof] fork > > The fork doesn't seem to be happening, or at least the woofAndWait is making > the whole program wait. To get it to run in the background, try #forkAt:, with a priority integer as the argument. I usually use something like: [myObject whatever] forkAt: Processor userBackgroundPriority Note that this is from memory, as opposed to being copied from a workspace, but it should be very close. HTH, Don > > Can anyone suggest a way to accomplish this? > > |
In reply to this post by Mark Wilden
Mark Wilden wrote:
> [(Sound fromFile: 'word'.wav') woofAndWait. > (Sound fromFile: 'sentence'.wav') woof] fork > > The fork doesn't seem to be happening, or at least the woofAndWait is > making the whole program wait. I haven't tried this, but #woofAndWait ends up in WinMMLibrary>>playSound:hmod:fwdSound: and that method is not "overlapped" (hence blocks execution of other Smalltalk Processes whilst it's running, even if it's run in a background Process). Try temporarily changing the definition to: playSound: aString hmod: anExternalHandle fdwSound: anInteger <overlap stdcall: bool PlaySoundA lpvoid handle dword> ^self invalidCall (the word "overlap" before "stdcall" is the only difference) and see if that makes it work how you'd expect. -- chris |
"Chris Uppal" <[hidden email]> wrote in message
news:[hidden email]... > > > [(Sound fromFile: 'word'.wav') woofAndWait. > > (Sound fromFile: 'sentence'.wav') woof] fork > > > > The fork doesn't seem to be happening, or at least the woofAndWait is > > making the whole program wait. > > WinMMLibrary>>playSound: aString hmod: anExternalHandle fdwSound: anInteger > <overlap stdcall: bool PlaySoundA lpvoid handle dword> > ^self invalidCall > > (the word "overlap" before "stdcall" is the only difference) This worked great, Chris - many thanks. I don't think I would have been able to figure this out without your help. |
Mark,
> > WinMMLibrary>>playSound: aString hmod: anExternalHandle fdwSound: > anInteger > > <overlap stdcall: bool PlaySoundA lpvoid handle dword> > > ^self invalidCall > > > > (the word "overlap" before "stdcall" is the only difference) > > This worked great, Chris - many thanks. I don't think I would have > been able to figure this out without your help. Just for your reference, this is discussed in the Education Centre at: http://www.object-arts.com/Lib/EducationCentre4/htm/externalinterfacing. htm and overlapped calls in particular at: http://www.object-arts.com/Lib/EducationCentre4/htm/overlappedcalls.htm Another, more flexible alternative, would be to use DirectSound. Some time ago I resurrected the old Dolphin DirectX packages from Dolphin 2.1 and converted them to D5. There's not a whole lot there, but DirectSound works okay as far as I can remember. Take a look at: http://groups.google.com/groups?q=dolphin+directsound&hl=en&lr=&ie=UTF-8 &oe=UTF-8&selm=3ec0ca8e%40news.totallyobjects.com&rnum=1 Best regards, Andy Bower Dolphin Support www.object-arts.com |
Andy,
> Another, more flexible alternative, would be to use DirectSound. Some > time ago I resurrected the old Dolphin DirectX packages from Dolphin > 2.1 and converted them to D5. There's not a whole lot there, but > DirectSound works okay as far as I can remember. Take a look at: > > http://groups.google.com/groups?q=dolphin+directsound&hl=en&lr=&ie=UTF-8 > &oe=UTF-8&selm=3ec0ca8e%40news.totallyobjects.com&rnum=1 Followed that up, thanks. The implementation seems to assume the existence of 'WAVE.DLL', which I don't have -- is that something that was part of the original package ? -- chris |
I wrote:
> The implementation seems to assume the > existence of 'WAVE.DLL', which I don't have -- is that something that was > part of the original package ? Never mind. I found a copy on an old NT(!) machine. A bit of tweaking and direct sound seems to be working fine. Ta. -- chris |
In reply to this post by Chris Uppal-3
[Once *again* apologies if you see this twice -- I am getting really sick of
<Nildram>'s pathetic news service] I wrote: > The implementation seems to assume the > existence of 'WAVE.DLL', which I don't have -- is that something that was > part of the original package ? Never mind. I found a copy on an old NT(!) machine. A bit of tweaking and direct sound seems to be working fine. Ta. -- chris |
Free forum by Nabble | Edit this page |