You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(Copied from jacius#1, originally reported by rhp in November 2009)
Hi,
I am trying to set-up a program in which I use SDL to play some sound from a pre-loaded buffer.
Using the callback method for OpenAudio gives me some trouble: it crashes after running through a few loops of the callback method.
See this example:
#! /usr/bin/ruby -w
require 'rubygems'
require 'ruby-sdl-ffi'
SDL.Init(SDL::INIT_AUDIO)
spec =
SDL::AudioSpec.new(
:freq => 22100,
:format => SDL::AUDIO_S16,
:channels => 2,
:silence => 0,
:samples => 512,
:padding => 0,
:size => 0,
:userdata => nil,
:callback => Proc.new { |unused, stream, len|
p stream
p len
}
)
raise "Could not open SDL audio" if SDL.OpenAudio(spec, nil) < 0
SDL.PauseAudio(0)
loop do
SDL.PollEvent do |event|
case event
when SDL::QuitEvent
exit(0)
else
# Do nothing
end
end
end
Comments from the original issue:
rhpNovember 15, 2009
Auch... that didn't go entirely right...
But I think you get the point... (ed: referring to broken formatting in the original post)
jaciusNovember 29, 2009
Hi. This library is still very young, so things are expected not to work. Thanks for the report though, I'll be sure to fix it in the future.
As a workaround until this is fixed, I would suggest using SDL::Mixer::OpenAudio instead, if you don't need all the advanced AudioSpec stuff.
The text was updated successfully, but these errors were encountered:
(Copied from jacius#1, originally reported by rhp in November 2009)
Hi,
I am trying to set-up a program in which I use SDL to play some sound from a pre-loaded buffer.
Using the callback method for OpenAudio gives me some trouble: it crashes after running through a few loops of the callback method.
See this example:
Comments from the original issue:
rhp November 15, 2009
Auch... that didn't go entirely right...
But I think you get the point...
(ed: referring to broken formatting in the original post)
jacius November 29, 2009
Hi. This library is still very young, so things are expected not to work. Thanks for the report though, I'll be sure to fix it in the future.
As a workaround until this is fixed, I would suggest using SDL::Mixer::OpenAudio instead, if you don't need all the advanced AudioSpec stuff.
The text was updated successfully, but these errors were encountered: