[Kde-games-devel] Junior job not only for GSoCers: Low-latency sound playback with KgSound

Roney Gomes roney477 at gmail.com
Tue Mar 20 00:42:46 UTC 2012


On 03/18/2012 01:50 AM, Ian Wadham wrote:
>
> On 18/03/2012, at 12:07 PM, Roney Gomes wrote:
>
>> On 03/07/2012 08:10 PM, Stefan Majewsky wrote:
>>> If you decide to work on porting a game, do not hesitate to ask for
>>> further assistance on this mailing list. Once your patch is done,
>>> upload it to http://svn.reviewboard.kde.org to get it reviewed.
>>
>> Hi, I began to browse Kapman's source code in an attempt to port it to KgSound, but some doubts came to my mind. Here follows the first.
>>
>> In the following assignment:
>> m_media1 = Phonon::createPlayer(Phonon::Gamecategory)
>>
>> A sound file is "attached" to m_media1, but in the documentation[1] I saw that this function takes a second argument (const MediaSource&  source), that is the source of the sound file itself.
>
> Two things to look at more closely:
> a) that second argument is a generalisation of a media source (not necessarily a file) and is optional,
> b) kapman is using two media players, m_media1 and m_media2.
>
>> So, taking in consideration that I can't explicitly see the file passed, wich file should I choose when calling the KgSound's constructor?
>
> Phonon opens a file every time it plays a sound and is not good at playing short sounds promptly
> and overlapping them correctly.  That is why we are switching to KgSound and OpenAL library
> for sounds in games.  You may need to experiment and think about how to use KgSound and
> OpenAL to best effect, e.g. whether to open and load all the sound files at startup time.an/listinfo/kde-games-devel

I worked in the code today and (almost) ported kapman to KgSound. 
Unluckly, a running-time error happens all the time: I can't hear the 
sounds while playing the game, in any circumstance.

I tried to debug it by myself but I'm still blind about what's happening.

Granatier was the example I followed, and I'm sure I reproduced exactly 
the same schema in my changes; there are pieces of code almost 
identical. I don't really know what's wrong.

I'm sending within this e-mail the files I've changed, game.h and 
game.cpp. I'd really appreciate your help.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: game.cpp
Type: text/x-c++src
Size: 14897 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-games-devel/attachments/20120319/0983edd8/attachment-0001.cpp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: game.h
Type: text/x-chdr
Size: 8164 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-games-devel/attachments/20120319/0983edd8/attachment-0001.h>


More information about the kde-games-devel mailing list