What about using a StablePtr? If you're dealing with hardware you would
get the
end-of-sample interrupt to free the buffer... Either way you either have
to delay GC
until the sample playback has finished... (well technically until the
soundcard DMA
has transferred the sample to the soundcards on
On Thu, 16 Dec 2004 08:46:58 +, Ben Rudiak-Gould
<[EMAIL PROTECTED]> wrote:
> Sebastian Sylvan wrote:
>
> >If there was a way to simply defer GC (like you attatch a function to
> >an object which can simply deny the GC the right to remove it
> >depending on its state) then I wouldn't have t
On Thu, 16 Dec 2004 09:46:34 +, Keean Schupke
<[EMAIL PROTECTED]> wrote:
> What about using a StablePtr? If you're dealing with hardware you would
> get the
> end-of-sample interrupt to free the buffer... Either way you either have
> to delay GC
> until the sample playback has finished... (well
On 16 Dec 2004, at 06:57, Sebastian Sylvan wrote:
Here's the problem though. If the SamplePlaybackRaw is currently
playing sound when it gets garbage collected, I want to keep the sound
resource (SoundSample) alive until the playback has finished.
I probably haven't understood the details correctly
Okay, you want to poll to see if the sound is still playing... This is
not very
easy to do...
You really want to use the low-buffer callback from the soundcard
driver to load the next sample into the buffer using DMA. (IE you
can pass a function to the driver to call when you sample has been
copi
Robert Dockins <[EMAIL PROTECTED]> schrieb am 16.12.04 14:56:49:
> This is exactly the guarantee you _don't_ have. The only guarantee you
> have is that it _won't_ be run if the Ptr _is_ being referenced.
>From the GHC library documentation:
newForeignPtr :: FinalizerPtr a -> Ptr a -> IO (
1) Finalizers are not (some say cannot) be guaranteed to run, even on
normal program termination, even if you force GC before exiting.
I only need a guarantee that it will be run if the Ptr is no longer
being referenced.
This is exactly the guarantee you _don't_ have. The only guarantee you
hav
This is exactly the guarantee you _don't_ have. The only guarantee you
have is that it _won't_ be run if the Ptr _is_ being referenced.
From the GHC library documentation:
newForeignPtr :: FinalizerPtr a -> Ptr a -> IO (ForeignPtr a)
[...] The only guarantee is that the finaliser runs
Udo Stenzel wrote:
Robert Dockins <[EMAIL PROTECTED]> schrieb am 16.12.04 14:56:49:
This is exactly the guarantee you _don't_ have. The only guarantee you
have is that it _won't_ be run if the Ptr _is_ being referenced.
From the GHC library documentation:
newForeignPtr :: FinalizerPtr
N.B. if you want a faster answer such questions are best posted to
[EMAIL PROTECTED]
My answer: I asume that your function all_rotations somehow needs to be
called recursively for the rest of the input list xs.
Cheers Christian
imranazad wrote:
Hi,
im not very good with haskell, i barely know t
-- play a sample
samplePlay :: SoundSample -> IO SamplePlayback
samplePlay sample = do ch <- withForeignPtr sample (fsound_PlaySound (-1))
let spb = SP ch sample -- SamplePlaybackRaw
mkWeakPtr spb (Just (samplePlaybackFinalizer spb))
From the System.Me
> imranazad wrote:
> > Hi,
> >
> > im not very good with haskell, i barely know the basics, my coursework
> > requires me to genereate a vigenere square...
> > well anyway at the moment im trying to define a functin all_rotations
> > which for any list returns the list of all its rotations, s
Sebastian Sylvan wrote:
On Thu, 16 Dec 2004 08:56:15 -0500, Robert Dockins
<[EMAIL PROTECTED]> wrote:
Return the high level value to the user; when the enclosed
ForeignPtr is garbage collected deRefWeak on the weak pointer will
return Nothing. Then the clean-up thread can begin polling the song
o
On 2004-12-16 at 17:00+0100 Henning Thielemann wrote:
>
> > imranazad wrote:
> > > Hi,
> > >
> > > im not very good with haskell, i barely know the
> > > basics, my coursework requires me to genereate a
> > > vigenere square... well anyway at the moment im
> > > trying to define a functin al
In which case I would assume the whole sample is copied to the sound
cards buffer
before the play call returns, so you don't have to worry and just let it
be garbage collected.
Keean
Sebastian Sylvan wrote:
On Thu, 16 Dec 2004 12:35:55 +, Keean Schupke
<[EMAIL PROTECTED]> wrote:
Okay,
Hello,
One of my favorite features from Python is its notion of "file-like
objects". For those of you unfamiliar with Python, here's a quick
backgrounder: anything can present a file-like interface. It could be
a file, socket, an interface to a gzip/gunzip processor, character set
codecs, in-me
Does anybody out there use Google Groups Beta to post to the
`fa.haskell' group? I am directly subscribed to the email list,
however I was trying some new things and it seemed like `fa.haskell'
was vaguely related to the Haskell Café list. However, my post has not
shown up on Haskell Café. D
John Goerzen wrote:
>My proposal is here:
>
> http://www.complete.org/~jgoerzen/t/MissingH.IO.HVIO.html
>
>I'm aware that others have been working on IO proposals; specifically,
>Simon Marlow's here:
>
> http://www.haskell.org/~simonmar/io/System.IO.html
The proposal on Simon M's page was origina
Sebastian Sylvan wrote:
>If there was a way to simply defer GC (like you attatch a function to
>an object which can simply deny the GC the right to remove it
>depending on its state) then I wouldn't have to do anything
>significant in the finalizer.
Why not spawn a thread which starts the playback,
Sebastian Sylvan wrote:
>Ben Rudiak-Gould wrote:
>>Why not spawn a thread which starts the playback, waits for it to
>>finish, and then exits, and wrap the whole thread in a call to
>>withForeignPtr? Then your finalizer won't be called prematurely.
>
>Well I could do this, but for one it would be c
On Thu, 16 Dec 2004 12:38:26 +, Jules Bean <[EMAIL PROTECTED]> wrote:
>
> On 16 Dec 2004, at 06:57, Sebastian Sylvan wrote:
>
> > Here's the problem though. If the SamplePlaybackRaw is currently
> > playing sound when it gets garbage collected, I want to keep the sound
> > resource (SoundSamp
On Thu, 16 Dec 2004 12:35:55 +, Keean Schupke
<[EMAIL PROTECTED]> wrote:
> Okay, you want to poll to see if the sound is still playing... This is
> not very
> easy to do...
>
> You really want to use the low-buffer callback from the soundcard
> driver to load the next sample into the buffer us
On 16 Dec 2004, at 15:20, Sebastian Sylvan wrote:
I really don't want to poll the sound sample all the time since it
uses up resources needlessly. If it comes to that, though, it's pretty
much guaranteed that it will get the job done.
A thread which polls once per second (and sleeps otherwise) is a
On Thu, 16 Dec 2004 08:56:15 -0500, Robert Dockins
<[EMAIL PROTECTED]> wrote:
> Return the high level value to the user; when the enclosed
> ForeignPtr is garbage collected deRefWeak on the weak pointer will
> return Nothing. Then the clean-up thread can begin polling the song
> object to see if
imranazad wrote:
> > Hi,
> >
> > im not very good with haskell, i barely know the basics, my coursework
> > requires me to genereate a vigenere square...
> > well anyway at the moment im trying to define a functin all_rotations
> > which for any list returns the list of all its rotations, so fa
25 matches
Mail list logo