Skip to content

Commit

Permalink
using freelist to instantiate Music and Sound
Browse files Browse the repository at this point in the history
  • Loading branch information
maniek2332 committed Dec 8, 2019
1 parent b7945ef commit 918d300
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions kaa/audio.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ cimport cython
from .kaacore.engine cimport get_c_engine
from .kaacore.audio cimport CAudioManager, CSound, CMusic, CMusicState

DEF SOUND_FREELIST_SIZE = 30
DEF MUSIC_FREELIST_SIZE = 10


class MusicState(IntEnum):
playing = <uint8_t>CMusicState.playing
paused = <uint8_t>CMusicState.paused
stopped = <uint8_t>CMusicState.stopped


@cython.freelist(SOUND_FREELIST_SIZE)
cdef class Sound:
cdef CSound c_sound

Expand Down Expand Up @@ -39,6 +43,7 @@ cdef Sound get_sound_wrapper(const CSound& c_sound):
return sound


@cython.freelist(MUSIC_FREELIST_SIZE)
cdef class Music:
cdef CMusic c_music

Expand Down
2 changes: 1 addition & 1 deletion kaacore

0 comments on commit 918d300

Please sign in to comment.