Re: [DirectPython] Examples
Status: Inactive
Brought to you by:
hsalo
|
From: Jeffrey B. <jef...@ea...> - 2006-07-11 17:38:38
|
On Tuesday 11 July 2006 08:45, Heikki Salo wrote:
> There are currently only two samples that use sounds: sampleShipEffects.py
> uses the d3d.Sound (with 3D effect in newer versions) and samplewx.py uses
> the d3d.Media. The objects are pretty simple to use, so there really is not
> that much to show.
>
> The Media-object (uses DirectShow) can play pretty much anything if corrent
> codecs (or filters) are registered. Sound (uses DirectSound) can only play
> .wav files. Googling for "directshow filter/codec <wanted format>" will
> probably find quite a few of them. The codecs are usually .exe-files that
> will register themself when installed. After this the Media should be able
> to play the formats that the codec supports.
>
> There are some bad codecs out there, so if possible try to get some
> information about them. Also note that .mp3 (and some other formats too) is
> supported directly by the DirectShow so there is usually no need to install
> any codecs in order to play them.
>
> --
> Heikki Salo
Thank you for your quick response.
I found sampleShipEffects.py. Emulating the code therein for playing a sound,
I tried:
>>> import d3d
>>> snd = d3d.Sound(u'c:/windows/media/tada.wav', True)
Traceback (most recent call last):
File "<pyshell#1>", line 1, in ?
snd = d3d.Sound(u'c:/windows/media/tada.wav', True)
Error: An invalid parameter was passed to the returning function
Also, when I try to run sampleShipEffects, it fails with:
Traceback (most recent call last):
File "C:\Python24\Lib\site-packages\directpy\samples\sampleShipEffects.py",
line 156, in ?
frame = SceneSample2(u"Ship and effects")
File "C:\Python24\lib\site-packages\directpy\d3dx.py", line 572, in __init__
fullscreen, CREATE.HARDWARE)
RuntimeError: Failed to create a device
I found an ogg decoder at Free-Codecs.com (which seems actually to be from
illiminable). I have installed it, so I hope that once I get past these
startup glitches, I will be able to play an ogg file using DirectPython.
Also, where do I find documentation for the DirectSound and DirectShow
sound-related objects? Besides playing a sound file, there are few more
functions that I need: I need to be able to get the current position (time)
of playback while a sound file is playing. I need to be able to specify a
starting time for play. And I need to be able to stop (or pause) playback.
Are those operations possible with DirectX?
In case it matters, I am on Windows XP running Python 2.4.3.
--
Jeffrey Barish
|