/* Generated by Pyrex 0.9.4.1 on Sun Jun 25 14:51:30 2006 */

#include "Python.h"
#include "structmember.h"
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifdef __cplusplus
#define __PYX_EXTERN_C extern "C"
#else
#define __PYX_EXTERN_C extern
#endif
__PYX_EXTERN_C double pow(double, double);
#include "stdlib.h"
#include "string.h"
#include "math.h"
#include "AL/altypes.h"
#include "AL/al.h"
#include "AL/alctypes.h"
#include "AL/alc.h"
#include "GL/glew.h"
#include "SDL/SDL_endian.h"
#include "SDL/SDL.h"
#include "chunk.h"
#include "matrix.h"
#include "cal3d_wrapper.h"
#include "freetype_include.h"


typedef struct {PyObject **p; char *s;} __Pyx_InternTabEntry; /*proto*/
typedef struct {PyObject **p; char *s; long n;} __Pyx_StringTabEntry; /*proto*/
static PyObject *__Pyx_UnpackItem(PyObject *, int); /*proto*/
static int __Pyx_EndUnpack(PyObject *, int); /*proto*/
static int __Pyx_PrintItem(PyObject *); /*proto*/
static int __Pyx_PrintNewline(void); /*proto*/
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
static void __Pyx_ReRaise(void); /*proto*/
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/
static PyObject *__Pyx_GetExcValue(void); /*proto*/
static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, char *name); /*proto*/
static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
static int __Pyx_GetStarArgs(PyObject **args, PyObject **kwds, char *kwd_list[], int nargs, PyObject **args2, PyObject **kwds2); /*proto*/
static void __Pyx_WriteUnraisable(char *name); /*proto*/
static void __Pyx_AddTraceback(char *funcname); /*proto*/
static PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name, long size);  /*proto*/
static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
static int __Pyx_GetVtable(PyObject *dict, void *vtabptr); /*proto*/
static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, char *modname); /*proto*/
static int __Pyx_InternStrings(__Pyx_InternTabEntry *t); /*proto*/
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/

static PyObject *__pyx_m;
static PyObject *__pyx_b;
static int __pyx_lineno;
static char *__pyx_filename;
static char **__pyx_f;

/* Declarations from _soya */

typedef struct {
  void (*content);
  int nb;
  int max;
} __pyx_t_5_soya_Chunk;

enum  {
  __pyx_e_5_soya_QUALITY_LOW = 0,
  __pyx_e_5_soya_QUALITY_MEDIUM = 1,
  __pyx_e_5_soya_QUALITY_HIGH = 2,
};

enum  {
  __pyx_e_5_soya_INITED = (1 << 0),
  __pyx_e_5_soya_USE_MIPMAP = (1 << 1),
  __pyx_e_5_soya_FULLSCREEN = (1 << 2),
  __pyx_e_5_soya_WIREFRAME = (1 << 3),
  __pyx_e_5_soya_FX_INITED = (1 << 4),
  __pyx_e_5_soya_SHADOWS = (1 << 5),
  __pyx_e_5_soya_HAS_STENCIL = (1 << 6),
};

enum  {
  __pyx_e_5_soya_MATERIAL_SEPARATE_SPECULAR = (1 << 1),
  __pyx_e_5_soya_MATERIAL_ADDITIVE_BLENDING = (1 << 2),
  __pyx_e_5_soya_MATERIAL_ALPHA = (1 << 3),
  __pyx_e_5_soya_MATERIAL_MASK = (1 << 4),
  __pyx_e_5_soya_MATERIAL_CLAMP = (1 << 5),
  __pyx_e_5_soya_MATERIAL_ENVIRONMENT_MAPPING = (1 << 6),
  __pyx_e_5_soya_MATERIAL_MIPMAP = (1 << 7),
  __pyx_e_5_soya_MATERIAL_BORDER = (1 << 8),
  __pyx_e_5_soya_MATERIAL_EMULATE_BORDER = (1 << 9),
};

enum  {
  __pyx_e_5_soya_VERTEX_ALPHA = (1 << 1),
  __pyx_e_5_soya_VERTEX_MADE = (1 << 3),
  __pyx_e_5_soya_VERTEX_INVISIBLE = (1 << 4),
  __pyx_e_5_soya_VERTEX_FX_TRANSITION = (1 << 5),
};

enum  {
  __pyx_e_5_soya_FACE_TRIANGLE = (1 << 0),
  __pyx_e_5_soya_FACE_QUAD = (1 << 1),
  __pyx_e_5_soya_FACE_NON_SOLID = (1 << 2),
  __pyx_e_5_soya_FACE_HIDDEN = (1 << 3),
  __pyx_e_5_soya_FACE_ALPHA = (1 << 4),
  __pyx_e_5_soya_FACE_DOUBLE_SIDED = (1 << 5),
  __pyx_e_5_soya_FACE_SMOOTH_LIT = (1 << 6),
  __pyx_e_5_soya_FACE_FRONT = (1 << 7),
  __pyx_e_5_soya_FACE_BACK = (1 << 8),
  __pyx_e_5_soya_FACE_NO_VERTEX_NORMAL_INFLUENCE = (1 << 9),
  __pyx_e_5_soya_FACE_NON_LIT = (1 << 10),
  __pyx_e_5_soya_FACE_STATIC_LIT = (1 << 11),
  __pyx_e_5_soya_FACE_LIGHT_FRONT = (1 << 12),
  __pyx_e_5_soya_FACE_LIGHT_BACK = (1 << 13),
};

enum  {
  __pyx_e_5_soya_PACK_SECONDPASS = (1 << 2),
  __pyx_e_5_soya_PACK_SPECIAL = (1 << 3),
};

enum  {
  __pyx_e_5_soya_HIDDEN = (1 << 0),
  __pyx_e_5_soya_LEFTHANDED = (1 << 3),
  __pyx_e_5_soya_NON_SOLID = (1 << 4),
  __pyx_e_5_soya_WORLD_BATCHED = (1 << 6),
  __pyx_e_5_soya_BONUS_BATCHED = (1 << 6),
  __pyx_e_5_soya_WORLD_PORTAL_LINKED = (1 << 7),
  __pyx_e_5_soya_LIGHT_TOP_LEVEL = (1 << 7),
  __pyx_e_5_soya_LIGHT_DIRECTIONAL = (1 << 8),
  __pyx_e_5_soya_LIGHT_NO_SHADOW = (1 << 9),
  __pyx_e_5_soya_LIGHT_SHADOW_COLOR = (1 << 10),
  __pyx_e_5_soya_LIGHT_STATIC = (1 << 11),
  __pyx_e_5_soya_LIGHT_INVALID = (1 << 6),
  __pyx_e_5_soya_CAMERA_PARTIAL = (1 << 5),
  __pyx_e_5_soya_CAMERA_ORTHO = (1 << 6),
  __pyx_e_5_soya_SOUND_PLAY_IN_3D = (1 << 6),
  __pyx_e_5_soya_SOUND_AUTO_REMOVE = (1 << 7),
  __pyx_e_5_soya_SOUND_LOOP = (1 << 8),
  __pyx_e_5_soya_FACE2_LIT = (1 << 12),
  __pyx_e_5_soya_FACE2_SMOOTH_LIT = (1 << 13),
  __pyx_e_5_soya_FACE2_STATIC_LIT = (1 << 14),
  __pyx_e_5_soya_FACE2_DOUBLE_SIDED = (1 << 15),
  __pyx_e_5_soya_COORDSYST_STATE_VALID = (1 << 16),
};

enum  {
  __pyx_e_5_soya_PORTAL_USE_4_CLIP_PLANES = (1 << 5),
  __pyx_e_5_soya_PORTAL_USE_5_CLIP_PLANES = (1 << 6),
  __pyx_e_5_soya_PORTAL_BOUND_ATMOSPHERE = (1 << 8),
  __pyx_e_5_soya_PORTAL_TELEPORTER = (1 << 9),
};

enum  {
  __pyx_e_5_soya_RAYPICK_CULL_FACE = (1 << 0),
  __pyx_e_5_soya_RAYPICK_HALF_LINE = (1 << 1),
};

enum  {
  __pyx_e_5_soya_RAYPICK_DIRECT = 1,
  __pyx_e_5_soya_RAYPICK_INDIRECT = 2,
};

enum  {
  __pyx_e_5_soya_COORDSYS_INVALID = 0,
  __pyx_e_5_soya_COORDSYS_ROOT_VALID = (1 << 0),
  __pyx_e_5_soya_COORDSYS_INVERTED_ROOT_VALID = (1 << 1),
  __pyx_e_5_soya_COORDSYS_STATIC = (1 << 19),
  __pyx_e_5_soya_COORDSYS_NON_AUTO_STATIC = (1 << 20),
};

enum  {
  __pyx_e_5_soya_RENDERER_STATE_OPAQUE = 0,
  __pyx_e_5_soya_RENDERER_STATE_SECONDPASS = 1,
  __pyx_e_5_soya_RENDERER_STATE_ALPHA = 2,
  __pyx_e_5_soya_RENDERER_STATE_SPECIAL = 3,
};

enum  {
  __pyx_e_5_soya_PACK_OPTIONS = ((((__pyx_e_5_soya_FACE_TRIANGLE | __pyx_e_5_soya_FACE_QUAD) | __pyx_e_5_soya_FACE_ALPHA) | __pyx_e_5_soya_FACE_DOUBLE_SIDED) | __pyx_e_5_soya_FACE_NON_LIT),
  __pyx_e_5_soya_DISPLAY_LIST_OPTIONS = ((((__pyx_e_5_soya_FACE_TRIANGLE | __pyx_e_5_soya_FACE_QUAD) | __pyx_e_5_soya_FACE_ALPHA) | __pyx_e_5_soya_FACE_DOUBLE_SIDED) | __pyx_e_5_soya_FACE_NON_LIT),
};

enum  {
  __pyx_e_5_soya_SHAPE_DIFFUSES = (1 << 5),
  __pyx_e_5_soya_SHAPE_EMISSIVES = (1 << 6),
  __pyx_e_5_soya_SHAPE_TEXCOORDS = (1 << 8),
  __pyx_e_5_soya_SHAPE_VERTEX_OPTIONS = (1 << 10),
  __pyx_e_5_soya_SHAPE_CELLSHADING = (1 << 11),
  __pyx_e_5_soya_SHAPE_NEVER_LIT = (1 << 12),
  __pyx_e_5_soya_SHAPE_PLANE_EQUATION = (1 << 14),
  __pyx_e_5_soya_SHAPE_NEIGHBORS = (1 << 15),
  __pyx_e_5_soya_SHAPE_INITED = (1 << 16),
  __pyx_e_5_soya_SHAPE_TREE = (1 << 17),
  __pyx_e_5_soya_SHAPE_DISPLAY_LISTS = (1 << 18),
  __pyx_e_5_soya_SHAPE_FACE_LIST = (1 << 19),
  __pyx_e_5_soya_SHAPE_HAS_SPHERE = (1 << 20),
  __pyx_e_5_soya_SHAPE_SHADOW = (1 << 21),
  __pyx_e_5_soya_SHAPE_STATIC_SHADOW = (1 << 22),
  __pyx_e_5_soya_SHAPE_STATIC_LIT = (1 << 23),
  __pyx_e_5_soya_SHAPE_SIMPLE_NEIGHBORS = (1 << 24),
};

enum  {
  __pyx_e_5_soya_TEXT_ALIGN_LEFT = 0,
  __pyx_e_5_soya_TEXT_ALIGN_CENTER = 1,
};

enum  {
  __pyx_e_5_soya_FONT_RASTER = 1,
  __pyx_e_5_soya_FONT_TEXTURE = 2,
};

enum  {
  __pyx_e_5_soya_ATMOSPHERE_FOG = (1 << 3),
  __pyx_e_5_soya_ATMOSPHERE_SKY_BOX_ALPHA = (1 << 7),
  __pyx_e_5_soya_ATMOSPHERE_HAS_CHILD = (1 << 8),
};

enum  {
  __pyx_e_5_soya_SPRITE_ALPHA = (1 << 7),
  __pyx_e_5_soya_SPRITE_COLORED = (1 << 9),
  __pyx_e_5_soya_SPRITE_NEVER_LIT = (1 << 11),
  __pyx_e_5_soya_SPRITE_RECEIVE_SHADOW = (1 << 12),
};

enum  {
  __pyx_e_5_soya_PARTICLES_MULTI_COLOR = (1 << 14),
  __pyx_e_5_soya_PARTICLES_MULTI_SIZE = (1 << 15),
  __pyx_e_5_soya_PARTICLES_CYLINDER = (1 << 16),
  __pyx_e_5_soya_PARTICLES_AUTO_GENERATE = (1 << 17),
  __pyx_e_5_soya_PARTICLES_REMOVABLE = (1 << 18),
};

enum  {
  __pyx_e_5_soya_LAND_INITED = (1 << 2),
  __pyx_e_5_soya_LAND_REAL_LOD_RAYPICK = (1 << 3),
  __pyx_e_5_soya_LAND_VERTEX_OPTIONS = (1 << 7),
  __pyx_e_5_soya_LAND_COLORED = (1 << 8),
};

enum  {
  __pyx_e_5_soya_LAND_VERTEX_HIDDEN = (1 << 0),
  __pyx_e_5_soya_LAND_VERTEX_ALPHA = __pyx_e_5_soya_VERTEX_ALPHA,
  __pyx_e_5_soya_LAND_VERTEX_NON_SOLID = (1 << 2),
  __pyx_e_5_soya_LAND_VERTEX_FORCE_PRESENCE = (1 << 3),
};

enum  {
  __pyx_e_5_soya_CAL3D_ALPHA = (1 << 5),
  __pyx_e_5_soya_CAL3D_CELL_SHADING = (1 << 6),
  __pyx_e_5_soya_CAL3D_SHADOW = (1 << 7),
  __pyx_e_5_soya_CAL3D_NEIGHBORS = (1 << 8),
  __pyx_e_5_soya_CAL3D_INITED = (1 << 9),
  __pyx_e_5_soya_CAL3D_DOUBLE_SIDED = (1 << 10),
};

typedef struct {
  float (position[3]);
  float (points[24]);
  float (planes[24]);
} __pyx_t_5_soya_Frustum;

struct __pyx_t_5_soya__Pack {
  int option;
  int material_id;
  struct __pyx_t_5_soya__Pack (*alpha);
  struct __pyx_t_5_soya__Pack (*secondpass);
  __pyx_t_5_soya_Chunk (*batched_faces);
};

typedef struct {
  int option;
  int id;
  int material_id;
  int (*faces_id);
  __pyx_t_5_soya_Chunk (*chunk);
} __pyx_t_5_soya_DisplayList;

typedef struct {
  int nb_opaque_list;
  int nb_alpha_list;
  __pyx_t_5_soya_DisplayList (*display_lists);
} __pyx_t_5_soya_DisplayLists;

typedef struct {
  int option;
  struct __pyx_t_5_soya__Pack (*pack);
  int normal;
  int (v[4]);
} __pyx_t_5_soya_ShapeFace;

struct __pyx_t_5_soya__Node {
  int nb_faces;
  int nb_children;
  int (*faces);
  struct __pyx_t_5_soya__Node (*(*children));
  float (sphere[4]);
};

typedef struct {
  float (texcoord[2]);
  float (normal[3]);
  float (coord[3]);
  struct __pyx_t_5_soya__Pack (*pack);
} __pyx_t_5_soya_LandVertex;

struct __pyx_t_5_soya__LandTri {
  char level;
  float (normal[3]);
  float (sphere[4]);
  __pyx_t_5_soya_LandVertex (*v1);
  __pyx_t_5_soya_LandVertex (*v2);
  __pyx_t_5_soya_LandVertex (*v3);
  struct __pyx_t_5_soya__LandTri (*parent);
  struct __pyx_t_5_soya__LandTri (*left_child);
  struct __pyx_t_5_soya__LandTri (*right_child);
  struct __pyx_t_5_soya__LandTri (*left_neighbor);
  struct __pyx_t_5_soya__LandTri (*right_neighbor);
  struct __pyx_t_5_soya__LandTri (*base_neighbor);
  struct __pyx_t_5_soya__Pack (*pack);
  struct __pyx_t_5_soya__LandPatch (*patch);
  int texcoord_type;
};

struct __pyx_t_5_soya__LandPatch {
  float (sphere[4]);
  char level;
  struct __pyx_t_5_soya__LandTri (*tri_top);
  struct __pyx_t_5_soya__LandTri (*tri_left);
  struct __pyx_t_5_soya__LandTri (*tri_right);
  struct __pyx_t_5_soya__LandTri (*tri_bottom);
  int visible;
};


struct __pyx_obj_5_soya__CObj {
  PyObject_HEAD
  struct __pyx_vtabstruct_5_soya__CObj *__pyx_vtab;
};

struct __pyx_vtabstruct_5_soya__CObj {
  PyObject *((*__getcstate__)(struct __pyx_obj_5_soya__CObj *));
  void ((*__setcstate__)(struct __pyx_obj_5_soya__CObj *,PyObject *));
};
static struct __pyx_vtabstruct_5_soya__CObj *__pyx_vtabptr_5_soya__CObj;


struct __pyx_obj_5_soya__Image {
  struct __pyx_obj_5_soya__CObj __pyx_base;
  int nb_color;
  int width;
  int height;
  GLubyte (*_pixels);
  PyObject *_filename;
};

struct __pyx_vtabstruct_5_soya__Image {
  struct __pyx_vtabstruct_5_soya__CObj __pyx_base;
  int ((*check_for_gl)(struct __pyx_obj_5_soya__Image *));
  GLuint ((*typ)(struct __pyx_obj_5_soya__Image *));
  GLuint ((*internal_format)(struct __pyx_obj_5_soya__Image *));
};
static struct __pyx_vtabstruct_5_soya__Image *__pyx_vtabptr_5_soya__Image;


struct __pyx_obj_5_soya__Material {
  struct __pyx_obj_5_soya__CObj __pyx_base;
  int _option;
  int _nb_packs;
  struct __pyx_obj_5_soya__Image *_texture;
  GLuint _id;
  float shininess;
  GLfloat (_diffuse[4]);
  GLfloat (_specular[4]);
  GLfloat (_emissive[4]);
  PyObject *_filename;
  struct __pyx_t_5_soya__Pack (*(*_packs));
};

struct __pyx_vtabstruct_5_soya__Material {
  struct __pyx_vtabstruct_5_soya__CObj __pyx_base;
  struct __pyx_t_5_soya__Pack (*((*_pack)(struct __pyx_obj_5_soya__Material *,int )));
  void ((*_init_texture)(struct __pyx_obj_5_soya__Material *));
  void ((*_build_2D_mipmaps)(struct __pyx_obj_5_soya__Material *,int ));
  void ((*_compute_alpha)(struct __pyx_obj_5_soya__Material *));
  void ((*_activate)(struct __pyx_obj_5_soya__Material *));
  void ((*_inactivate)(struct __pyx_obj_5_soya__Material *));
};
static struct __pyx_vtabstruct_5_soya__Material *__pyx_vtabptr_5_soya__Material;


struct __pyx_obj_5_soya__Shape {
  struct __pyx_obj_5_soya__CObj __pyx_base;
  PyObject *_filename;
};

struct __pyx_vtabstruct_5_soya__Shape {
  struct __pyx_vtabstruct_5_soya__CObj __pyx_base;
  void ((*_instanced)(struct __pyx_obj_5_soya__Shape *,struct __pyx_obj_5_soya__Volume *,PyObject *));
  void ((*_batch)(struct __pyx_obj_5_soya__Shape *,struct __pyx_obj_5_soya_CoordSyst *));
  void ((*_render)(struct __pyx_obj_5_soya__Shape *,struct __pyx_obj_5_soya_CoordSyst *));
  int ((*_shadow)(struct __pyx_obj_5_soya__Shape *,struct __pyx_obj_5_soya_CoordSyst *,struct __pyx_obj_5_soya__Light *));
  void ((*_get_box)(struct __pyx_obj_5_soya__Shape *,float (*),float (*)));
  void ((*_raypick)(struct __pyx_obj_5_soya__Shape *,struct __pyx_obj_5_soya_RaypickData *,struct __pyx_obj_5_soya_CoordSyst *));
  int ((*_raypick_b)(struct __pyx_obj_5_soya__Shape *,struct __pyx_obj_5_soya_RaypickData *,struct __pyx_obj_5_soya_CoordSyst *));
  void ((*_collect_raypickables)(struct __pyx_obj_5_soya__Shape *,__pyx_t_5_soya_Chunk (*),float (*),float (*),struct __pyx_obj_5_soya_CoordSyst *));
};
static struct __pyx_vtabstruct_5_soya__Shape *__pyx_vtabptr_5_soya__Shape;


struct __pyx_obj_5_soya__SimpleShape {
  struct __pyx_obj_5_soya__Shape __pyx_base;
  int _option;
  PyObject *_materials;
  int _nb_faces;
  int _nb_vertices;
  int _nb_coords;
  int _nb_vnormals;
  int _nb_colors;
  int _nb_values;
  float (*_coords);
  float (*_vnormals);
  float (*_colors);
  float (*_values);
  int (*_vertex_coords);
  int (*_vertex_texcoords);
  int (*_vertex_diffuses);
  int (*_vertex_emissives);
  char (*_vertex_options);
  __pyx_t_5_soya_ShapeFace (*_faces);
  int (*_neighbors);
  int (*_simple_neighbors);
  char (*_neighbors_side);
  char (*_simple_neighbors_side);
  __pyx_t_5_soya_DisplayLists (*_display_lists);
  float (*_sphere);
};

struct __pyx_vtabstruct_5_soya__SimpleShape {
  struct __pyx_vtabstruct_5_soya__Shape __pyx_base;
  void ((*__setcstate_data__)(struct __pyx_obj_5_soya__SimpleShape *,PyObject *));
  void ((*_register_material)(struct __pyx_obj_5_soya__SimpleShape *,struct __pyx_obj_5_soya__Material *));
  void ((*_add_coord)(struct __pyx_obj_5_soya__SimpleShape *,struct __pyx_obj_5_soya__Vertex *));
  int ((*_register_value)(struct __pyx_obj_5_soya__SimpleShape *,float (*),int ));
  int ((*_register_color)(struct __pyx_obj_5_soya__SimpleShape *,float (*)));
  void ((*_add_face)(struct __pyx_obj_5_soya__SimpleShape *,struct __pyx_obj_5_soya__Face *,PyObject *,PyObject *,PyObject *,int ));
  int ((*_add_vertex)(struct __pyx_obj_5_soya__SimpleShape *,struct __pyx_obj_5_soya__Vertex *,PyObject *,PyObject *,PyObject *,int ));
  PyObject *((*_identify_vertices)(struct __pyx_obj_5_soya__SimpleShape *,PyObject *,float ));
  void ((*_compute_face_normals)(struct __pyx_obj_5_soya__SimpleShape *,PyObject *));
  void ((*_compute_vertex_normals)(struct __pyx_obj_5_soya__SimpleShape *,PyObject *,PyObject *,PyObject *));
  void ((*_compute_face_neighbors)(struct __pyx_obj_5_soya__SimpleShape *,PyObject *,PyObject *,PyObject *,int (*),char (*)));
  void ((*_build_sphere)(struct __pyx_obj_5_soya__SimpleShape *));
  void ((*_build_display_list)(struct __pyx_obj_5_soya__SimpleShape *));
  void ((*_init_display_list)(struct __pyx_obj_5_soya__SimpleShape *));
  void ((*_batch_face)(struct __pyx_obj_5_soya__SimpleShape *,__pyx_t_5_soya_ShapeFace (*)));
  void ((*_face_raypick)(struct __pyx_obj_5_soya__SimpleShape *,__pyx_t_5_soya_ShapeFace (*),float (*),struct __pyx_obj_5_soya_RaypickData *,struct __pyx_obj_5_soya_CoordSyst *));
  int ((*_face_raypick_b)(struct __pyx_obj_5_soya__SimpleShape *,__pyx_t_5_soya_ShapeFace (*),float (*),struct __pyx_obj_5_soya_RaypickData *));
  void ((*_render_triangle)(struct __pyx_obj_5_soya__SimpleShape *,__pyx_t_5_soya_ShapeFace (*)));
  void ((*_render_quad)(struct __pyx_obj_5_soya__SimpleShape *,__pyx_t_5_soya_ShapeFace (*)));
  void ((*_render_vertex)(struct __pyx_obj_5_soya__SimpleShape *,int ,int ));
  int ((*_build_shadow)(struct __pyx_obj_5_soya__SimpleShape *,struct __pyx_obj_5_soya_CoordSyst *,struct __pyx_obj_5_soya__Light *,int ,int ));
};
static struct __pyx_vtabstruct_5_soya__SimpleShape *__pyx_vtabptr_5_soya__SimpleShape;


struct __pyx_obj_5_soya__CellShadingShape {
  struct __pyx_obj_5_soya__SimpleShape __pyx_base;
  struct __pyx_obj_5_soya__Material *_shader;
  float (_outline_color[4]);
  float _outline_width;
  float _outline_attenuation;
};

struct __pyx_vtabstruct_5_soya__CellShadingShape {
  struct __pyx_vtabstruct_5_soya__SimpleShape __pyx_base;
  void ((*_build_cellshading)(struct __pyx_obj_5_soya__CellShadingShape *,struct __pyx_obj_5_soya__Material *,PyObject *,float ,float ));
  void ((*_render_outline)(struct __pyx_obj_5_soya__CellShadingShape *,__pyx_t_5_soya_Frustum (*)));
  void ((*_prepare_cellshading_shades)(struct __pyx_obj_5_soya__CellShadingShape *,float (*),PyObject *));
  void ((*_prepare_cellshading)(struct __pyx_obj_5_soya__CellShadingShape *,struct __pyx_obj_5_soya_CoordSyst *,float (*)));
  float ((*_vertex_compute_cellshading)(struct __pyx_obj_5_soya__CellShadingShape *,float (*),float (*),PyObject *,float ));
  void ((*_render_triangle_cellshading)(struct __pyx_obj_5_soya__CellShadingShape *,__pyx_t_5_soya_ShapeFace (*),float (*)));
  void ((*_render_quad_cellshading)(struct __pyx_obj_5_soya__CellShadingShape *,__pyx_t_5_soya_ShapeFace (*),float (*)));
  void ((*_render_vertex_cellshading_smoothlit)(struct __pyx_obj_5_soya__CellShadingShape *,int ,int ,float (*)));
  void ((*_render_vertex_cellshading)(struct __pyx_obj_5_soya__CellShadingShape *,int ,int ,float (*)));
};
static struct __pyx_vtabstruct_5_soya__CellShadingShape *__pyx_vtabptr_5_soya__CellShadingShape;


struct __pyx_obj_5_soya__TreeShape {
  struct __pyx_obj_5_soya__SimpleShape __pyx_base;
  struct __pyx_t_5_soya__Node (*_tree);
};

struct __pyx_vtabstruct_5_soya__TreeShape {
  struct __pyx_vtabstruct_5_soya__SimpleShape __pyx_base;
  PyObject *((*_node2chunk)(struct __pyx_obj_5_soya__TreeShape *,struct __pyx_t_5_soya__Node (*),__pyx_t_5_soya_Chunk (*)));
  struct __pyx_t_5_soya__Node (*((*_chunk2node)(struct __pyx_obj_5_soya__TreeShape *,__pyx_t_5_soya_Chunk (*))));
  void ((*_build_tree)(struct __pyx_obj_5_soya__TreeShape *));
  void ((*_optimize_tree)(struct __pyx_obj_5_soya__TreeShape *,float ,int ,float ));
  void ((*compute_sphere)(struct __pyx_obj_5_soya__TreeShape *,__pyx_t_5_soya_ShapeFace (*),float (*)));
  void ((*_batch_node)(struct __pyx_obj_5_soya__TreeShape *,struct __pyx_t_5_soya__Node (*),__pyx_t_5_soya_Frustum (*)));
  void ((*_node_raypick)(struct __pyx_obj_5_soya__TreeShape *,struct __pyx_t_5_soya__Node (*),float (*),struct __pyx_obj_5_soya_RaypickData *,struct __pyx_obj_5_soya_CoordSyst *));
  int ((*_node_raypick_b)(struct __pyx_obj_5_soya__TreeShape *,struct __pyx_t_5_soya__Node (*),float (*),struct __pyx_obj_5_soya_RaypickData *));
  void ((*_raypick_from_context)(struct __pyx_obj_5_soya__TreeShape *,struct __pyx_obj_5_soya_RaypickData *,__pyx_t_5_soya_Chunk (*)));
  int ((*_raypick_from_context_b)(struct __pyx_obj_5_soya__TreeShape *,struct __pyx_obj_5_soya_RaypickData *,__pyx_t_5_soya_Chunk (*)));
};
static struct __pyx_vtabstruct_5_soya__TreeShape *__pyx_vtabptr_5_soya__TreeShape;


struct __pyx_obj_5_soya__ModelData {
  struct __pyx_obj_5_soya__CObj __pyx_base;
};

struct __pyx_vtabstruct_5_soya__ModelData {
  struct __pyx_vtabstruct_5_soya__CObj __pyx_base;
  void ((*_attach)(struct __pyx_obj_5_soya__ModelData *,PyObject *));
  void ((*_detach)(struct __pyx_obj_5_soya__ModelData *,PyObject *));
  int ((*_is_attached)(struct __pyx_obj_5_soya__ModelData *,PyObject *));
  void ((*_attach_to_bone)(struct __pyx_obj_5_soya__ModelData *,struct __pyx_obj_5_soya_CoordSyst *,PyObject *));
  void ((*_detach_from_bone)(struct __pyx_obj_5_soya__ModelData *,struct __pyx_obj_5_soya_CoordSyst *));
  void ((*_advance_time)(struct __pyx_obj_5_soya__ModelData *,float ));
  void ((*_begin_round)(struct __pyx_obj_5_soya__ModelData *));
  PyObject *((*_get_attached_meshes)(struct __pyx_obj_5_soya__ModelData *));
  PyObject *((*_get_attached_coordsysts)(struct __pyx_obj_5_soya__ModelData *));
  void ((*_animate_blend_cycle)(struct __pyx_obj_5_soya__ModelData *,PyObject *,float ,float ));
  void ((*_animate_clear_cycle)(struct __pyx_obj_5_soya__ModelData *,PyObject *,float ));
  void ((*_animate_execute_action)(struct __pyx_obj_5_soya__ModelData *,PyObject *,float ,float ));
  void ((*_animate_reset)(struct __pyx_obj_5_soya__ModelData *));
  void ((*_set_lod_level)(struct __pyx_obj_5_soya__ModelData *,float ));
};
static struct __pyx_vtabstruct_5_soya__ModelData *__pyx_vtabptr_5_soya__ModelData;


struct __pyx_obj_5_soya__AnimatedModelData {
  struct __pyx_obj_5_soya__ModelData __pyx_base;
  struct __pyx_obj_5_soya__Volume *_volume;
  struct __pyx_obj_5_soya__Cal3dShape *_shape;
  PyObject *_attached_meshes;
  PyObject *_attached_coordsysts;
  struct CalModel (*_cal_model);
  float _delta_time;
  float (*_face_planes);
  float (*_vertex_coords);
  float (*_vertex_normals);
  int _face_plane_ok;
  int _vertex_ok;
};

struct __pyx_vtabstruct_5_soya__AnimatedModelData {
  struct __pyx_vtabstruct_5_soya__ModelData __pyx_base;
  void ((*_build_submeshes)(struct __pyx_obj_5_soya__AnimatedModelData *));
  void ((*_build_face_planes)(struct __pyx_obj_5_soya__AnimatedModelData *));
  void ((*_build_vertices)(struct __pyx_obj_5_soya__AnimatedModelData *,int ));
  void ((*_attach_all)(struct __pyx_obj_5_soya__AnimatedModelData *));
};
static struct __pyx_vtabstruct_5_soya__AnimatedModelData *__pyx_vtabptr_5_soya__AnimatedModelData;


struct __pyx_obj_5_soya_Position {
  struct __pyx_obj_5_soya__CObj __pyx_base;
  struct __pyx_obj_5_soya_CoordSyst *_parent;
};

struct __pyx_vtabstruct_5_soya_Position {
  struct __pyx_vtabstruct_5_soya__CObj __pyx_base;
  void ((*_into)(struct __pyx_obj_5_soya_Position *,struct __pyx_obj_5_soya_CoordSyst *,float (*)));
  void ((*_out)(struct __pyx_obj_5_soya_Position *,float (*)));
};
static struct __pyx_vtabstruct_5_soya_Position *__pyx_vtabptr_5_soya_Position;


struct __pyx_obj_5_soya__Point {
  struct __pyx_obj_5_soya_Position __pyx_base;
  float (_matrix[3]);
};

struct __pyx_vtabstruct_5_soya__Point {
  struct __pyx_vtabstruct_5_soya_Position __pyx_base;
};
static struct __pyx_vtabstruct_5_soya__Point *__pyx_vtabptr_5_soya__Point;


struct __pyx_obj_5_soya__Vector {
  struct __pyx_obj_5_soya__Point __pyx_base;
};

struct __pyx_vtabstruct_5_soya__Vector {
  struct __pyx_vtabstruct_5_soya__Point __pyx_base;
};
static struct __pyx_vtabstruct_5_soya__Vector *__pyx_vtabptr_5_soya__Vector;


struct __pyx_obj_5_soya__Vertex {
  struct __pyx_obj_5_soya__Point __pyx_base;
  float _tex_x;
  float _tex_y;
  PyObject *_diffuse;
  PyObject *_emissive;
  struct __pyx_obj_5_soya__Face *_face;
  struct __pyx_obj_5_soya__Vector *_normal;
};

struct __pyx_vtabstruct_5_soya__Vertex {
  struct __pyx_vtabstruct_5_soya__Point __pyx_base;
  void ((*_render)(struct __pyx_obj_5_soya__Vertex *,struct __pyx_obj_5_soya_CoordSyst *));
  float ((*_angle_at)(struct __pyx_obj_5_soya__Vertex *));
};
static struct __pyx_vtabstruct_5_soya__Vertex *__pyx_vtabptr_5_soya__Vertex;


struct __pyx_obj_5_soya_CoordSyst {
  struct __pyx_obj_5_soya_Position __pyx_base;
  float (_matrix[19]);
  float (__root_matrix[19]);
  float (__inverted_root_matrix[19]);
  float (_render_matrix[19]);
  int _frustum_id;
  int _validity;
  int __raypick_data;
  int _option;
  int _auto_static_count;
};

struct __pyx_vtabstruct_5_soya_CoordSyst {
  struct __pyx_vtabstruct_5_soya_Position __pyx_base;
  void ((*_batch)(struct __pyx_obj_5_soya_CoordSyst *,struct __pyx_obj_5_soya_CoordSyst *));
  void ((*_render)(struct __pyx_obj_5_soya_CoordSyst *,struct __pyx_obj_5_soya_CoordSyst *));
  int ((*_shadow)(struct __pyx_obj_5_soya_CoordSyst *,struct __pyx_obj_5_soya_CoordSyst *,struct __pyx_obj_5_soya__Light *));
  void ((*_raypick)(struct __pyx_obj_5_soya_CoordSyst *,struct __pyx_obj_5_soya_RaypickData *,struct __pyx_obj_5_soya_CoordSyst *));
  int ((*_raypick_b)(struct __pyx_obj_5_soya_CoordSyst *,struct __pyx_obj_5_soya_RaypickData *,struct __pyx_obj_5_soya_CoordSyst *));
  void ((*_collect_raypickables)(struct __pyx_obj_5_soya_CoordSyst *,__pyx_t_5_soya_Chunk (*),float (*),float (*)));
  int ((*_contains)(struct __pyx_obj_5_soya_CoordSyst *,struct __pyx_obj_5_soya__CObj *));
  float (*((*_raypick_data)(struct __pyx_obj_5_soya_CoordSyst *,struct __pyx_obj_5_soya_RaypickData *)));
  float ((*_distance_out)(struct __pyx_obj_5_soya_CoordSyst *,float ));
  void ((*_invalidate)(struct __pyx_obj_5_soya_CoordSyst *));
  void ((*check_lefthanded)(struct __pyx_obj_5_soya_CoordSyst *));
  float (*((*_root_matrix)(struct __pyx_obj_5_soya_CoordSyst *)));
  float (*((*_inverted_root_matrix)(struct __pyx_obj_5_soya_CoordSyst *)));
  struct __pyx_obj_5_soya__World *((*_get_root)(struct __pyx_obj_5_soya_CoordSyst *));
  void ((*_get_box)(struct __pyx_obj_5_soya_CoordSyst *,float (*),float (*)));
  void ((*_get_sphere)(struct __pyx_obj_5_soya_CoordSyst *,float (*)));
  void ((*_go_static)(struct __pyx_obj_5_soya_CoordSyst *));
  void ((*_go_not_static)(struct __pyx_obj_5_soya_CoordSyst *));
};
static struct __pyx_vtabstruct_5_soya_CoordSyst *__pyx_vtabptr_5_soya_CoordSyst;


struct __pyx_obj_5_soya__Camera {
  struct __pyx_obj_5_soya_CoordSyst __pyx_base;
  struct __pyx_obj_5_soya__World *_to_render;
  float _front;
  float _back;
  float _fov;
  __pyx_t_5_soya_Frustum (*_frustum);
  int (_viewport[4]);
  PyObject *_master;
};

struct __pyx_vtabstruct_5_soya__Camera {
  struct __pyx_vtabstruct_5_soya_CoordSyst __pyx_base;
  void ((*_init_frustum)(struct __pyx_obj_5_soya__Camera *));
  void ((*_subrender_scene)(struct __pyx_obj_5_soya__Camera *));
  void ((*_render_scene)(struct __pyx_obj_5_soya__Camera *));
};
static struct __pyx_vtabstruct_5_soya__Camera *__pyx_vtabptr_5_soya__Camera;


struct __pyx_obj_5_soya__Light {
  struct __pyx_obj_5_soya_CoordSyst __pyx_base;
  float radius;
  float _w;
  float _constant;
  float _linear;
  float _quadratic;
  float _angle;
  float _exponent;
  float (_colors[16]);
  float (_data[3]);
  int _id;
  int _gl_id_enabled;
  PyObject *_static_shadow_displaylists;
};

struct __pyx_vtabstruct_5_soya__Light {
  struct __pyx_vtabstruct_5_soya_CoordSyst __pyx_base;
  int ((*_shadow_at)(struct __pyx_obj_5_soya__Light *,float (*)));
  float ((*_spotlight_at)(struct __pyx_obj_5_soya__Light *,float (*)));
  float ((*_attenuation_at)(struct __pyx_obj_5_soya__Light *,float (*)));
  void ((*_static_light_at)(struct __pyx_obj_5_soya__Light *,float (*),float (*),int ,float (*)));
  void ((*_cast_into)(struct __pyx_obj_5_soya__Light *,struct __pyx_obj_5_soya_CoordSyst *));
  void ((*_activate)(struct __pyx_obj_5_soya__Light *));
  void ((*_compute_radius)(struct __pyx_obj_5_soya__Light *));
};
static struct __pyx_vtabstruct_5_soya__Light *__pyx_vtabptr_5_soya__Light;


struct __pyx_obj_5_soya__Volume {
  struct __pyx_obj_5_soya_CoordSyst __pyx_base;
  struct __pyx_obj_5_soya__Shape *_shape;
  struct __pyx_obj_5_soya__ModelData *_data;
};

struct __pyx_vtabstruct_5_soya__Volume {
  struct __pyx_vtabstruct_5_soya_CoordSyst __pyx_base;
};
static struct __pyx_vtabstruct_5_soya__Volume *__pyx_vtabptr_5_soya__Volume;


struct __pyx_obj_5_soya__World {
  struct __pyx_obj_5_soya__Volume __pyx_base;
  PyObject *children;
  struct __pyx_obj_5_soya__Atmosphere *_atmosphere;
  PyObject *_filename;
  struct __pyx_obj_5_soya_Shapifier *_shapifier;
};

struct __pyx_vtabstruct_5_soya__World {
  struct __pyx_vtabstruct_5_soya__Volume __pyx_base;
  void ((*_search_all)(struct __pyx_obj_5_soya__World *,PyObject *,PyObject *));
};
static struct __pyx_vtabstruct_5_soya__World *__pyx_vtabptr_5_soya__World;


struct __pyx_obj_5_soya__Face {
  struct __pyx_obj_5_soya_CoordSyst __pyx_base;
  PyObject *_vertices;
  struct __pyx_obj_5_soya__Material *_material;
  struct __pyx_obj_5_soya__Vector *_normal;
};

struct __pyx_vtabstruct_5_soya__Face {
  struct __pyx_vtabstruct_5_soya_CoordSyst __pyx_base;
  void ((*_compute_normal)(struct __pyx_obj_5_soya__Face *));
};
static struct __pyx_vtabstruct_5_soya__Face *__pyx_vtabptr_5_soya__Face;


struct __pyx_obj_5_soya__Cal3dShape {
  struct __pyx_obj_5_soya__Shape __pyx_base;
  int _option;
  int _nb_faces;
  int _nb_vertices;
  float (_sphere[4]);
  PyObject *_meshes;
  PyObject *_animations;
  PyObject *_materials;
  PyObject *_submeshes;
  PyObject *_full_filename;
  struct CalCoreModel (*_core_model);
  struct __pyx_obj_5_soya__Material *_shader;
  float (_outline_color[4]);
  float _outline_width;
  float _outline_attenuation;
};

struct __pyx_vtabstruct_5_soya__Cal3dShape {
  struct __pyx_vtabstruct_5_soya__Shape __pyx_base;
  void ((*_build_submeshes)(struct __pyx_obj_5_soya__Cal3dShape *));
  void ((*_set_face_neighborhood)(struct __pyx_obj_5_soya__Cal3dShape *,int ,int ,GLfloat (*)));
  void ((*_set_cell_shading)(struct __pyx_obj_5_soya__Cal3dShape *,struct __pyx_obj_5_soya__Material *,GLfloat (*),GLfloat ));
  void ((*_prepare_cellshading)(struct __pyx_obj_5_soya__Cal3dShape *,struct __pyx_obj_5_soya_CoordSyst *,float (*),int ,float (*),float (*)));
  void ((*_prepare_cellshading_shades)(struct __pyx_obj_5_soya__Cal3dShape *,float (*),PyObject *,int ,float (*),float (*)));
  void ((*_render_outline)(struct __pyx_obj_5_soya__Cal3dShape *,struct __pyx_obj_5_soya__Cal3dSubMesh *,__pyx_t_5_soya_Frustum (*),float (*),float (*),float (*)));
  struct __pyx_obj_5_soya__Material *((*_get_material_4_cal3d)(struct __pyx_obj_5_soya__Cal3dShape *,PyObject *,float ,float ,float ,float ,float ,float ,float ,float ,float ));
  struct __pyx_obj_5_soya__Material *((*_create_material_4_cal3d)(struct __pyx_obj_5_soya__Cal3dShape *,PyObject *,float ,float ,float ,float ,float ,float ,float ,float ,float ));
  void ((*_set_texture_from_model)(struct __pyx_obj_5_soya__Cal3dShape *,struct __pyx_obj_5_soya__Material *,PyObject *));
  int ((*_shadow2)(struct __pyx_obj_5_soya__Cal3dShape *,struct __pyx_obj_5_soya__Cal3dSubMesh *,struct __pyx_obj_5_soya__Volume *,struct __pyx_obj_5_soya__Light *,float (*),float (*),float (*)));
  void ((*_build_vertices)(struct __pyx_obj_5_soya__Cal3dShape *,struct __pyx_obj_5_soya__AnimatedModelData *));
};
static struct __pyx_vtabstruct_5_soya__Cal3dShape *__pyx_vtabptr_5_soya__Cal3dShape;


struct __pyx_obj_5_soya__Sprite {
  struct __pyx_obj_5_soya_CoordSyst __pyx_base;
  float _width;
  float _height;
  float (_color[4]);
  struct __pyx_obj_5_soya__Material *_material;
};

struct __pyx_vtabstruct_5_soya__Sprite {
  struct __pyx_vtabstruct_5_soya_CoordSyst __pyx_base;
  void ((*_compute_alpha)(struct __pyx_obj_5_soya__Sprite *));
};
static struct __pyx_vtabstruct_5_soya__Sprite *__pyx_vtabptr_5_soya__Sprite;


struct __pyx_obj_5_soya__Portal {
  struct __pyx_obj_5_soya_CoordSyst __pyx_base;
  struct __pyx_obj_5_soya__World *_beyond;
  PyObject *_beyond_name;
  double (*_equation);
  struct __pyx_obj_5_soya_Context *_context;
  int _nb_vertices;
  float (*_coords);
};

struct __pyx_vtabstruct_5_soya__Portal {
  struct __pyx_vtabstruct_5_soya_CoordSyst __pyx_base;
  void ((*_compute_clipping_planes)(struct __pyx_obj_5_soya__Portal *));
  void ((*_compute_points)(struct __pyx_obj_5_soya__Portal *));
  void ((*_atmosphere_clear_part)(struct __pyx_obj_5_soya__Portal *));
  void ((*_draw_fog)(struct __pyx_obj_5_soya__Portal *,struct __pyx_obj_5_soya__Atmosphere *));
};
static struct __pyx_vtabstruct_5_soya__Portal *__pyx_vtabptr_5_soya__Portal;


struct __pyx_obj_5_soya__Land {
  struct __pyx_obj_5_soya_CoordSyst __pyx_base;
  PyObject *_materials;
  __pyx_t_5_soya_LandVertex (*_vertices);
  char (*_vertex_options);
  int (*_vertex_colors);
  float (*_vertex_geos);
  float (*_normals);
  int _nb_colors;
  float (*_colors);
  int _nb_vertex_width;
  int _nb_vertex_depth;
  int _patch_size;
  int _max_level;
  float _texture_factor;
  float _scale_factor;
  float _split_factor;
  int _nb_patchs;
  int _nb_patch_width;
  int _nb_patch_depth;
  struct __pyx_t_5_soya__LandPatch (*_patchs);
};

struct __pyx_vtabstruct_5_soya__Land {
  struct __pyx_vtabstruct_5_soya_CoordSyst __pyx_base;
  __pyx_t_5_soya_LandVertex (*((*_get_vertex)(struct __pyx_obj_5_soya__Land *,int ,int )));
  void ((*_check_size)(struct __pyx_obj_5_soya__Land *));
  void ((*_free_patchs)(struct __pyx_obj_5_soya__Land *));
  void ((*__del__)(struct __pyx_obj_5_soya__Land *));
  void ((*_add_material)(struct __pyx_obj_5_soya__Land *,struct __pyx_obj_5_soya__Material *));
  float ((*_get_height)(struct __pyx_obj_5_soya__Land *,int ,int ));
  void ((*_set_height)(struct __pyx_obj_5_soya__Land *,int ,int ,float ));
  void ((*_init)(struct __pyx_obj_5_soya__Land *));
  void ((*_compute_normal)(struct __pyx_obj_5_soya__Land *,int ,int ));
  void ((*_compute_normals)(struct __pyx_obj_5_soya__Land *));
  void ((*_compute_coords)(struct __pyx_obj_5_soya__Land *));
  void ((*_create_patch)(struct __pyx_obj_5_soya__Land *,struct __pyx_t_5_soya__LandPatch (*),int ,int ,int ));
  void ((*_create_patchs)(struct __pyx_obj_5_soya__Land *));
  int ((*_register_color)(struct __pyx_obj_5_soya__Land *,float (*)));
  void ((*_tri_split)(struct __pyx_obj_5_soya__Land *,struct __pyx_t_5_soya__LandTri (*)));
  int ((*_tri_merge_child)(struct __pyx_obj_5_soya__Land *,struct __pyx_t_5_soya__LandTri (*)));
  void ((*_tri_set_level)(struct __pyx_obj_5_soya__Land *,struct __pyx_t_5_soya__LandTri (*),char ));
  void ((*_patch_set_level)(struct __pyx_obj_5_soya__Land *,struct __pyx_t_5_soya__LandPatch (*),char ));
  int ((*_patch_update)(struct __pyx_obj_5_soya__Land *,struct __pyx_t_5_soya__LandPatch (*),__pyx_t_5_soya_Frustum (*),float (*)));
  void ((*_tri_force_presence)(struct __pyx_obj_5_soya__Land *,struct __pyx_t_5_soya__LandTri (*),__pyx_t_5_soya_LandVertex (*)));
  void ((*_force_presence)(struct __pyx_obj_5_soya__Land *));
  void ((*_tri_batch)(struct __pyx_obj_5_soya__Land *,struct __pyx_t_5_soya__LandTri (*),__pyx_t_5_soya_Frustum (*)));
  void ((*_patch_batch)(struct __pyx_obj_5_soya__Land *,struct __pyx_t_5_soya__LandPatch (*),__pyx_t_5_soya_Frustum (*)));
  void ((*_tri_render_middle)(struct __pyx_obj_5_soya__Land *,struct __pyx_t_5_soya__LandTri (*)));
  void ((*_tri_render_secondpass)(struct __pyx_obj_5_soya__Land *,struct __pyx_t_5_soya__LandTri (*)));
  void ((*_tri_raypick)(struct __pyx_obj_5_soya__Land *,struct __pyx_t_5_soya__LandTri (*),float (*),struct __pyx_obj_5_soya_RaypickData *));
  int ((*_tri_raypick_b)(struct __pyx_obj_5_soya__Land *,struct __pyx_t_5_soya__LandTri (*),float (*),int ));
  void ((*_full_raypick)(struct __pyx_obj_5_soya__Land *,__pyx_t_5_soya_LandVertex (*),__pyx_t_5_soya_LandVertex (*),__pyx_t_5_soya_LandVertex (*),float (*),float (*),struct __pyx_obj_5_soya_RaypickData *));
  void ((*_full_raypick_rect)(struct __pyx_obj_5_soya__Land *,int ,int ,int ,int ,float (*),struct __pyx_obj_5_soya_RaypickData *));
  int ((*_full_raypick_b)(struct __pyx_obj_5_soya__Land *,__pyx_t_5_soya_LandVertex (*),__pyx_t_5_soya_LandVertex (*),__pyx_t_5_soya_LandVertex (*),float (*),float (*),int ));
  int ((*_full_raypick_rect_b)(struct __pyx_obj_5_soya__Land *,int ,int ,int ,int ,float (*),int ));
  void ((*_check_vertex_options)(struct __pyx_obj_5_soya__Land *));
  int ((*_check_color)(struct __pyx_obj_5_soya__Land *,float (*)));
  void ((*_vertex_render_special)(struct __pyx_obj_5_soya__Land *,__pyx_t_5_soya_LandVertex (*)));
};
static struct __pyx_vtabstruct_5_soya__Land *__pyx_vtabptr_5_soya__Land;


struct __pyx_obj_5_soya__Atmosphere {
  struct __pyx_obj_5_soya__CObj __pyx_base;
  int _option;
  int _fog_type;
  float _fog_start;
  float _fog_end;
  float _fog_density;
  float (_ambient[4]);
  float (_bg_color[4]);
  float (_fog_color[4]);
};

struct __pyx_vtabstruct_5_soya__Atmosphere {
  struct __pyx_vtabstruct_5_soya__CObj __pyx_base;
  void ((*_clear)(struct __pyx_obj_5_soya__Atmosphere *));
  void ((*_draw_bg)(struct __pyx_obj_5_soya__Atmosphere *));
  void ((*_render)(struct __pyx_obj_5_soya__Atmosphere *));
  float ((*_fog_factor_at)(struct __pyx_obj_5_soya__Atmosphere *,float (*)));
};
static struct __pyx_vtabstruct_5_soya__Atmosphere *__pyx_vtabptr_5_soya__Atmosphere;


struct __pyx_obj_5_soya_Renderer {
  PyObject_HEAD
  struct __pyx_vtabstruct_5_soya_Renderer *__pyx_vtab;
  int engine_option;
  int state;
  struct __pyx_obj_5_soya__World *root_object;
  struct __pyx_obj_5_soya__Camera *current_camera;
  struct __pyx_obj_5_soya__Material *current_material;
  __pyx_t_5_soya_Frustum (*root_frustum);
  __pyx_t_5_soya_Chunk (*frustums);
  struct __pyx_obj_5_soya_CoordSyst *current_coordsyst;
  struct __pyx_obj_5_soya_Context *current_context;
  PyObject *contexts;
  int nb_contexts;
  int max_contexts;
  struct __pyx_obj_5_soya__Atmosphere *root_atmosphere;
  __pyx_t_5_soya_Chunk (*opaque);
  __pyx_t_5_soya_Chunk (*secondpass);
  __pyx_t_5_soya_Chunk (*alpha);
  __pyx_t_5_soya_Chunk (*specials);
  PyObject *top_lights;
  PyObject *worlds_made;
  PyObject *portals;
  PyObject *watercubes;
  __pyx_t_5_soya_Chunk (*data);
  __pyx_t_5_soya_Chunk (*used_opaque_packs);
  __pyx_t_5_soya_Chunk (*used_secondpass_packs);
  __pyx_t_5_soya_Chunk (*used_alpha_packs);
  float (*(*colors));
  SDL_Surface (*screen);
  int screen_width;
  int screen_height;
  float delta_time;
};

struct __pyx_vtabstruct_5_soya_Renderer {
  __pyx_t_5_soya_Frustum (*((*_frustum)(struct __pyx_obj_5_soya_Renderer *,struct __pyx_obj_5_soya_CoordSyst *)));
  struct __pyx_obj_5_soya_Context *((*_context)(struct __pyx_obj_5_soya_Renderer *));
  void ((*_activate_context_over)(struct __pyx_obj_5_soya_Renderer *,struct __pyx_obj_5_soya_Context *,struct __pyx_obj_5_soya_Context *));
  void ((*_reset)(struct __pyx_obj_5_soya_Renderer *));
  void ((*_batch)(struct __pyx_obj_5_soya_Renderer *,__pyx_t_5_soya_Chunk (*),PyObject *,struct __pyx_obj_5_soya_CoordSyst *,int ));
  void ((*_render)(struct __pyx_obj_5_soya_Renderer *));
  void ((*_render_list)(struct __pyx_obj_5_soya_Renderer *,__pyx_t_5_soya_Chunk (*)));
  void ((*_clear_screen)(struct __pyx_obj_5_soya_Renderer *,float (*)));
  void ((*_render_shadows)(struct __pyx_obj_5_soya_Renderer *));
};
static struct __pyx_vtabstruct_5_soya_Renderer *__pyx_vtabptr_5_soya_Renderer;


struct __pyx_obj_5_soya_Context {
  PyObject_HEAD
  PyObject *lights;
  struct __pyx_obj_5_soya__Atmosphere *atmosphere;
  struct __pyx_obj_5_soya__Portal *portal;
};


struct __pyx_obj_5_soya_RaypickData {
  PyObject_HEAD
  int option;
  __pyx_t_5_soya_Chunk (*raypicked);
  __pyx_t_5_soya_Chunk (*raypick_data);
  float (root_data[7]);
  float (normal[3]);
  float result;
  float root_result;
  struct __pyx_obj_5_soya_CoordSyst *result_coordsyst;
};


struct __pyx_obj_5_soya_RaypickContext {
  PyObject_HEAD
  __pyx_t_5_soya_Chunk (*_items);
  struct __pyx_obj_5_soya__World *_root;
};


struct __pyx_obj_5_soya_Idler {
  PyObject_HEAD
  PyObject *_next_round_tasks;
  PyObject *_return_value;
  PyObject *_scenes;
  double round_duration;
  double min_frame_duration;
  double fps;
  int running;
  int will_render;
  double _time;
  double _time_since_last_round;
  double _last_fps_computation_time;
  int _nb_frame;
};


struct __pyx_obj_5_soya_Glyph {
  PyObject_HEAD
  float _pixels_x1;
  float _pixels_y1;
  float _pixels_x2;
  float _pixels_y2;
  float width;
  float height;
  float y;
  float x;
  PyObject *unichar;
};


struct __pyx_obj_5_soya_Font {
  PyObject_HEAD
  struct __pyx_vtabstruct_5_soya_Font *__pyx_vtab;
  FT_Face _face;
  PyObject *filename;
  int _width;
  int _height;
  PyObject *_glyphs;
  GLubyte (*_pixels);
  int _current_x;
  int _current_y;
  int _current_height;
  int _pixels_height;
  int _rendering;
  GLuint _tex_id;
};

struct __pyx_vtabstruct_5_soya_Font {
  struct __pyx_obj_5_soya_Glyph *((*_get_glyph)(struct __pyx_obj_5_soya_Font *,PyObject *));
  PyObject *((*_gen_glyph)(struct __pyx_obj_5_soya_Font *,PyObject *,int ));
  void ((*_sizeup_pixel)(struct __pyx_obj_5_soya_Font *,int ));
  void ((*_init)(struct __pyx_obj_5_soya_Font *));
};
static struct __pyx_vtabstruct_5_soya_Font *__pyx_vtabptr_5_soya_Font;


struct __pyx_obj_5_soya_Shapifier {
  struct __pyx_obj_5_soya__CObj __pyx_base;
};

struct __pyx_vtabstruct_5_soya_Shapifier {
  struct __pyx_vtabstruct_5_soya__CObj __pyx_base;
  struct __pyx_obj_5_soya__Shape *((*_shapify)(struct __pyx_obj_5_soya_Shapifier *,struct __pyx_obj_5_soya__World *));
};
static struct __pyx_vtabstruct_5_soya_Shapifier *__pyx_vtabptr_5_soya_Shapifier;


struct __pyx_obj_5_soya_Traveling {
  struct __pyx_obj_5_soya__CObj __pyx_base;
  struct __pyx_obj_5_soya_CoordSyst *_incline_as;
  int _smooth_move;
  int _smooth_rotation;
};

struct __pyx_vtabstruct_5_soya_Traveling {
  struct __pyx_vtabstruct_5_soya__CObj __pyx_base;
};
static struct __pyx_vtabstruct_5_soya_Traveling *__pyx_vtabptr_5_soya_Traveling;


struct __pyx_obj_5_soya__TravelingCamera {
  struct __pyx_obj_5_soya__Camera __pyx_base;
  PyObject *_travelings;
  struct __pyx_obj_5_soya_Traveling *_traveling;
  float _speed_value;
  float _proportion;
  struct __pyx_obj_5_soya__Vector *_speed;
};

struct __pyx_vtabstruct_5_soya__TravelingCamera {
  struct __pyx_vtabstruct_5_soya__Camera __pyx_base;
  void ((*_traveling_changed)(struct __pyx_obj_5_soya__TravelingCamera *));
};
static struct __pyx_vtabstruct_5_soya__TravelingCamera *__pyx_vtabptr_5_soya__TravelingCamera;


struct __pyx_obj_5_soya__NoBackgroundAtmosphere {
  struct __pyx_obj_5_soya__Atmosphere __pyx_base;
};

struct __pyx_vtabstruct_5_soya__NoBackgroundAtmosphere {
  struct __pyx_vtabstruct_5_soya__Atmosphere __pyx_base;
};
static struct __pyx_vtabstruct_5_soya__NoBackgroundAtmosphere *__pyx_vtabptr_5_soya__NoBackgroundAtmosphere;


struct __pyx_obj_5_soya__SkyAtmosphere {
  struct __pyx_obj_5_soya__Atmosphere __pyx_base;
  float (_sky_color[4]);
  float _cloud_scale;
  struct __pyx_obj_5_soya__Material *_cloud;
  PyObject *_sky_box;
};

struct __pyx_vtabstruct_5_soya__SkyAtmosphere {
  struct __pyx_vtabstruct_5_soya__Atmosphere __pyx_base;
  void ((*_draw_sky_plane)(struct __pyx_obj_5_soya__SkyAtmosphere *));
  void ((*_draw_sky_box)(struct __pyx_obj_5_soya__SkyAtmosphere *));
};
static struct __pyx_vtabstruct_5_soya__SkyAtmosphere *__pyx_vtabptr_5_soya__SkyAtmosphere;


struct __pyx_obj_5_soya_PythonCoordSyst {
  struct __pyx_obj_5_soya_CoordSyst __pyx_base;
};

struct __pyx_vtabstruct_5_soya_PythonCoordSyst {
  struct __pyx_vtabstruct_5_soya_CoordSyst __pyx_base;
};
static struct __pyx_vtabstruct_5_soya_PythonCoordSyst *__pyx_vtabptr_5_soya_PythonCoordSyst;


struct __pyx_obj_5_soya_CoordSystState {
  struct __pyx_obj_5_soya_CoordSyst __pyx_base;
  float (_quaternion[4]);
};

struct __pyx_vtabstruct_5_soya_CoordSystState {
  struct __pyx_vtabstruct_5_soya_CoordSyst __pyx_base;
  void ((*_check_state_validity)(struct __pyx_obj_5_soya_CoordSystState *));
};
static struct __pyx_vtabstruct_5_soya_CoordSystState *__pyx_vtabptr_5_soya_CoordSystState;


struct __pyx_obj_5_soya__FixTraveling {
  struct __pyx_obj_5_soya_Traveling __pyx_base;
  struct __pyx_obj_5_soya_Position *_target;
  struct __pyx_obj_5_soya_Position *_direction;
};

struct __pyx_vtabstruct_5_soya__FixTraveling {
  struct __pyx_vtabstruct_5_soya_Traveling __pyx_base;
};
static struct __pyx_vtabstruct_5_soya__FixTraveling *__pyx_vtabptr_5_soya__FixTraveling;


struct __pyx_obj_5_soya__ThirdPersonTraveling {
  struct __pyx_obj_5_soya_Traveling __pyx_base;
  struct __pyx_obj_5_soya_Position *_target;
  struct __pyx_obj_5_soya__Point *__target;
  struct __pyx_obj_5_soya__Point *_best;
  struct __pyx_obj_5_soya__Point *_result;
  struct __pyx_obj_5_soya__Point *__direction;
  struct __pyx_obj_5_soya__Vector *_direction;
  struct __pyx_obj_5_soya__Vector *__normal;
  float _distance;
  float _offset_y;
  float _offset_y2;
  float _lateral_angle;
  float _top_view;
  float _speed;
  struct __pyx_obj_5_soya_RaypickContext *_context;
};

struct __pyx_vtabstruct_5_soya__ThirdPersonTraveling {
  struct __pyx_vtabstruct_5_soya_Traveling __pyx_base;
  float ((*_check)(struct __pyx_obj_5_soya__ThirdPersonTraveling *,struct __pyx_obj_5_soya_RaypickContext *,struct __pyx_obj_5_soya_Position *,struct __pyx_obj_5_soya__Vector *,struct __pyx_obj_5_soya__Point *));
};
static struct __pyx_vtabstruct_5_soya__ThirdPersonTraveling *__pyx_vtabptr_5_soya__ThirdPersonTraveling;


struct __pyx_obj_5_soya__PythonMaterial {
  struct __pyx_obj_5_soya__Material __pyx_base;
};

struct __pyx_vtabstruct_5_soya__PythonMaterial {
  struct __pyx_vtabstruct_5_soya__Material __pyx_base;
};
static struct __pyx_vtabstruct_5_soya__PythonMaterial *__pyx_vtabptr_5_soya__PythonMaterial;


struct __pyx_obj_5_soya__CylinderSprite {
  struct __pyx_obj_5_soya__Sprite __pyx_base;
};

struct __pyx_vtabstruct_5_soya__CylinderSprite {
  struct __pyx_vtabstruct_5_soya__Sprite __pyx_base;
};
static struct __pyx_vtabstruct_5_soya__CylinderSprite *__pyx_vtabptr_5_soya__CylinderSprite;


struct __pyx_obj_5_soya__Bonus {
  struct __pyx_obj_5_soya_CoordSyst __pyx_base;
  float _angle;
  float (_color[4]);
  struct __pyx_obj_5_soya__Material *_material;
  struct __pyx_obj_5_soya__Material *_halo;
};

struct __pyx_vtabstruct_5_soya__Bonus {
  struct __pyx_vtabstruct_5_soya_CoordSyst __pyx_base;
};
static struct __pyx_vtabstruct_5_soya__Bonus *__pyx_vtabptr_5_soya__Bonus;


struct __pyx_obj_5_soya__Particles {
  struct __pyx_obj_5_soya_CoordSyst __pyx_base;
  struct __pyx_obj_5_soya__Material *_material;
  struct __pyx_obj_5_soya_CoordSyst *_particle_coordsyst;
  int _nb_particles;
  int _nb_max_particles;
  int _particle_size;
  float (*_particles);
  float _delta_time;
  int _nb_colors;
  int _nb_sizes;
  float (*_fading_colors);
  float (*_sizes);
  int _nb_creatable_particles;
  int _max_particles_per_round;
};

struct __pyx_vtabstruct_5_soya__Particles {
  struct __pyx_vtabstruct_5_soya_CoordSyst __pyx_base;
  void ((*_reinit)(struct __pyx_obj_5_soya__Particles *));
  void ((*_advance)(struct __pyx_obj_5_soya__Particles *,float ));
  void ((*_compute_alpha)(struct __pyx_obj_5_soya__Particles *));
  void ((*_get_fading_color)(struct __pyx_obj_5_soya__Particles *,float ,float ,float (*)));
  void ((*_get_size)(struct __pyx_obj_5_soya__Particles *,float ,float ,float (*)));
  float (*((*_generate)(struct __pyx_obj_5_soya__Particles *,int ,float )));
};
static struct __pyx_vtabstruct_5_soya__Particles *__pyx_vtabptr_5_soya__Particles;


struct __pyx_obj_5_soya_FlagFirework {
  struct __pyx_obj_5_soya__Particles __pyx_base;
  struct __pyx_obj_5_soya__Particles *_subgenerator;
  int _nb_sub_particles;
};

struct __pyx_vtabstruct_5_soya_FlagFirework {
  struct __pyx_vtabstruct_5_soya__Particles __pyx_base;
};
static struct __pyx_vtabstruct_5_soya_FlagFirework *__pyx_vtabptr_5_soya_FlagFirework;


struct __pyx_obj_5_soya_SimpleShapifier {
  struct __pyx_obj_5_soya_Shapifier __pyx_base;
  int _shadow;
  float _max_face_angle;
};

struct __pyx_vtabstruct_5_soya_SimpleShapifier {
  struct __pyx_vtabstruct_5_soya_Shapifier __pyx_base;
};
static struct __pyx_vtabstruct_5_soya_SimpleShapifier *__pyx_vtabptr_5_soya_SimpleShapifier;


struct __pyx_obj_5_soya_TreeShapifier {
  struct __pyx_obj_5_soya_SimpleShapifier __pyx_base;
  float _collapsing_distance;
  int _quality;
  float _max_child_radius;
};

struct __pyx_vtabstruct_5_soya_TreeShapifier {
  struct __pyx_vtabstruct_5_soya_SimpleShapifier __pyx_base;
};
static struct __pyx_vtabstruct_5_soya_TreeShapifier *__pyx_vtabptr_5_soya_TreeShapifier;


struct __pyx_obj_5_soya_CellShadingShapifier {
  struct __pyx_obj_5_soya_SimpleShapifier __pyx_base;
  struct __pyx_obj_5_soya__Material *_shader;
  PyObject *_outline_color;
  float _outline_width;
  float _outline_attenuation;
};

struct __pyx_vtabstruct_5_soya_CellShadingShapifier {
  struct __pyx_vtabstruct_5_soya_SimpleShapifier __pyx_base;
};
static struct __pyx_vtabstruct_5_soya_CellShadingShapifier *__pyx_vtabptr_5_soya_CellShadingShapifier;


struct __pyx_obj_5_soya__Cal3dSubMesh {
  PyObject_HEAD
  struct __pyx_vtabstruct_5_soya__Cal3dSubMesh *__pyx_vtab;
  int _option;
  int _mesh;
  int _submesh;
  struct __pyx_obj_5_soya__Material *_material;
  int _nb_faces;
  int _nb_vertices;
  int (*_faces);
  int (*_face_neighbors);
};

struct __pyx_vtabstruct_5_soya__Cal3dSubMesh {
  PyObject *((*_build)(struct __pyx_obj_5_soya__Cal3dSubMesh *,struct __pyx_obj_5_soya__Cal3dShape *,struct CalRenderer (*),struct CalCoreModel (*),struct CalCoreMesh (*),int ,int ));
  void ((*_build_neighbors)(struct __pyx_obj_5_soya__Cal3dSubMesh *,PyObject *,float (*)));
};
static struct __pyx_vtabstruct_5_soya__Cal3dSubMesh *__pyx_vtabptr_5_soya__Cal3dSubMesh;

static PyTypeObject *__pyx_ptype_5_soya__CObj = 0;
static PyTypeObject *__pyx_ptype_5_soya__Image = 0;
static PyTypeObject *__pyx_ptype_5_soya__Material = 0;
static PyTypeObject *__pyx_ptype_5_soya__Shape = 0;
static PyTypeObject *__pyx_ptype_5_soya__SimpleShape = 0;
static PyTypeObject *__pyx_ptype_5_soya__CellShadingShape = 0;
static PyTypeObject *__pyx_ptype_5_soya__TreeShape = 0;
static PyTypeObject *__pyx_ptype_5_soya__ModelData = 0;
static PyTypeObject *__pyx_ptype_5_soya__AnimatedModelData = 0;
static PyTypeObject *__pyx_ptype_5_soya_Position = 0;
static PyTypeObject *__pyx_ptype_5_soya__Point = 0;
static PyTypeObject *__pyx_ptype_5_soya__Vector = 0;
static PyTypeObject *__pyx_ptype_5_soya__Vertex = 0;
static PyTypeObject *__pyx_ptype_5_soya_CoordSyst = 0;
static PyTypeObject *__pyx_ptype_5_soya__Camera = 0;
static PyTypeObject *__pyx_ptype_5_soya__Light = 0;
static PyTypeObject *__pyx_ptype_5_soya__Volume = 0;
static PyTypeObject *__pyx_ptype_5_soya__World = 0;
static PyTypeObject *__pyx_ptype_5_soya__Face = 0;
static PyTypeObject *__pyx_ptype_5_soya__Cal3dShape = 0;
static PyTypeObject *__pyx_ptype_5_soya__Sprite = 0;
static PyTypeObject *__pyx_ptype_5_soya__Portal = 0;
static PyTypeObject *__pyx_ptype_5_soya__Land = 0;
static PyTypeObject *__pyx_ptype_5_soya__Atmosphere = 0;
static PyTypeObject *__pyx_ptype_5_soya_Renderer = 0;
static PyTypeObject *__pyx_ptype_5_soya_Context = 0;
static PyTypeObject *__pyx_ptype_5_soya_RaypickData = 0;
static PyTypeObject *__pyx_ptype_5_soya_RaypickContext = 0;
static PyTypeObject *__pyx_ptype_5_soya_Idler = 0;
static PyTypeObject *__pyx_ptype_5_soya_Glyph = 0;
static PyTypeObject *__pyx_ptype_5_soya_Font = 0;
static PyTypeObject *__pyx_ptype_5_soya_Shapifier = 0;
static PyTypeObject *__pyx_ptype_5_soya_Traveling = 0;
static PyTypeObject *__pyx_ptype_5_soya__TravelingCamera = 0;
static PyTypeObject *__pyx_ptype_5_soya__NoBackgroundAtmosphere = 0;
static PyTypeObject *__pyx_ptype_5_soya__SkyAtmosphere = 0;
static PyTypeObject *__pyx_ptype_5_soya_PythonCoordSyst = 0;
static PyTypeObject *__pyx_ptype_5_soya_CoordSystState = 0;
static PyTypeObject *__pyx_ptype_5_soya__FixTraveling = 0;
static PyTypeObject *__pyx_ptype_5_soya__ThirdPersonTraveling = 0;
static PyTypeObject *__pyx_ptype_5_soya__PythonMaterial = 0;
static PyTypeObject *__pyx_ptype_5_soya__CylinderSprite = 0;
static PyTypeObject *__pyx_ptype_5_soya__Bonus = 0;
static PyTypeObject *__pyx_ptype_5_soya__Particles = 0;
static PyTypeObject *__pyx_ptype_5_soya_FlagFirework = 0;
static PyTypeObject *__pyx_ptype_5_soya_SimpleShapifier = 0;
static PyTypeObject *__pyx_ptype_5_soya_TreeShapifier = 0;
static PyTypeObject *__pyx_ptype_5_soya_CellShadingShapifier = 0;
static PyTypeObject *__pyx_ptype_5_soya__Cal3dSubMesh = 0;

/* Declarations from _sound */


struct __pyx_obj_6_sound__Sound {
  struct __pyx_obj_5_soya__CObj __pyx_base;
  PyObject *_filename;
  PyObject *_buffers;
  PyObject *_file;
  int _format;
  int _framerate;
};

struct __pyx_vtabstruct_6_sound__Sound {
  struct __pyx_vtabstruct_5_soya__CObj __pyx_base;
  ALuint ((*_getbuffer)(struct __pyx_obj_6_sound__Sound *,PyObject *));
};
static struct __pyx_vtabstruct_6_sound__Sound *__pyx_vtabptr_6_sound__Sound;


struct __pyx_obj_6_sound__WAVSound {
  struct __pyx_obj_6_sound__Sound __pyx_base;
};

struct __pyx_vtabstruct_6_sound__WAVSound {
  struct __pyx_vtabstruct_6_sound__Sound __pyx_base;
  PyObject *((*_getnextdata)(struct __pyx_obj_6_sound__WAVSound *));
};
static struct __pyx_vtabstruct_6_sound__WAVSound *__pyx_vtabptr_6_sound__WAVSound;


struct __pyx_obj_6_sound__OGGVorbisSound {
  struct __pyx_obj_6_sound__Sound __pyx_base;
};

struct __pyx_vtabstruct_6_sound__OGGVorbisSound {
  struct __pyx_vtabstruct_6_sound__Sound __pyx_base;
  PyObject *((*_getdata)(struct __pyx_obj_6_sound__OGGVorbisSound *,int ));
};
static struct __pyx_vtabstruct_6_sound__OGGVorbisSound *__pyx_vtabptr_6_sound__OGGVorbisSound;


struct __pyx_obj_6_sound__SoundPlayer {
  struct __pyx_obj_5_soya_CoordSyst __pyx_base;
  struct __pyx_obj_6_sound__Sound *_sound;
  ALuint _source;
  ALuint _current_buffer;
  ALuint _pending_buffer;
  int _current_buffer_id;
  float (_old_pos[3]);
};

struct __pyx_vtabstruct_6_sound__SoundPlayer {
  struct __pyx_vtabstruct_5_soya_CoordSyst __pyx_base;
};
static struct __pyx_vtabstruct_6_sound__SoundPlayer *__pyx_vtabptr_6_sound__SoundPlayer;

static PyTypeObject *__pyx_ptype_6_sound__Sound = 0;
static PyTypeObject *__pyx_ptype_6_sound__WAVSound = 0;
static PyTypeObject *__pyx_ptype_6_sound__OGGVorbisSound = 0;
static PyTypeObject *__pyx_ptype_6_sound__SoundPlayer = 0;
static struct __pyx_obj_5_soya_CoordSyst *__pyx_v_6_sound_EAR;
static int __pyx_v_6_sound__SOUND_INITED;
static ALCdevice (*__pyx_v_6_sound__device);
static ALCcontext (*__pyx_v_6_sound__context);
static PyObject *__pyx_k3;
static PyObject *__pyx_k4;
static PyObject *__pyx_k5;
static struct __pyx_obj_5_soya__World *__pyx_k6;
static struct __pyx_obj_6_sound__Sound *__pyx_k7;
static int __pyx_k8;
static int __pyx_k9;
static float __pyx_k10;
static int __pyx_k11;
static PyObject *(__pyx_f_6_sound_chunk_to_string(__pyx_t_5_soya_Chunk (*))); /*proto*/
static PyObject *(__pyx_f_6_sound_drop_chunk_to_string(__pyx_t_5_soya_Chunk (*))); /*proto*/
static __pyx_t_5_soya_Chunk (*(__pyx_f_6_sound_string_to_chunk(PyObject *))); /*proto*/

/* Implementation of _sound */

static char (__pyx_k2[]) = "'( ( devices '( native esd sdl alsa arts null ) ) )";

static PyObject *__pyx_n__soya;
static PyObject *__pyx_n_ALError;
static PyObject *__pyx_n_check_al_error;
static PyObject *__pyx_n_init_sound;
static PyObject *__pyx_n_StandardError;

static PyObject *__pyx_k2p;

static PyObject *__pyx_f_6_sound_chunk_to_string(__pyx_t_5_soya_Chunk (*__pyx_v_chunk)) {
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;

  /* "/home/jiba/src/soya/sound/sound.pyx":21 */
  __pyx_1 = PyString_FromStringAndSize(((char (*))__pyx_v_chunk->content),__pyx_v_chunk->nb); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; goto __pyx_L1;}
  __pyx_r = __pyx_1;
  __pyx_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("_sound.chunk_to_string");
  __pyx_r = 0;
  __pyx_L0:;
  return __pyx_r;
}

static PyObject *__pyx_f_6_sound_drop_chunk_to_string(__pyx_t_5_soya_Chunk (*__pyx_v_chunk)) {
  PyObject *__pyx_v_string;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  __pyx_v_string = Py_None; Py_INCREF(Py_None);

  /* "/home/jiba/src/soya/sound/sound.pyx":25 */
  __pyx_1 = PyString_FromStringAndSize(((char (*))__pyx_v_chunk->content),__pyx_v_chunk->nb); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; goto __pyx_L1;}
  Py_DECREF(__pyx_v_string);
  __pyx_v_string = __pyx_1;
  __pyx_1 = 0;

  /* "/home/jiba/src/soya/sound/sound.pyx":26 */
  drop_chunk(__pyx_v_chunk);

  /* "/home/jiba/src/soya/sound/sound.pyx":27 */
  Py_INCREF(__pyx_v_string);
  __pyx_r = __pyx_v_string;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("_sound.drop_chunk_to_string");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_string);
  return __pyx_r;
}

static __pyx_t_5_soya_Chunk (*__pyx_f_6_sound_string_to_chunk(PyObject *__pyx_v_string)) {
  __pyx_t_5_soya_Chunk (*__pyx_v_chunk);
  int __pyx_v_length;
  __pyx_t_5_soya_Chunk (*__pyx_r);
  int __pyx_1;
  Py_INCREF(__pyx_v_string);

  /* "/home/jiba/src/soya/sound/sound.pyx":32 */
  __pyx_1 = PyObject_Length(__pyx_v_string); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; goto __pyx_L1;}
  __pyx_v_length = __pyx_1;

  /* "/home/jiba/src/soya/sound/sound.pyx":33 */
  __pyx_v_chunk = get_chunk();

  /* "/home/jiba/src/soya/sound/sound.pyx":34 */
  chunk_register(__pyx_v_chunk,__pyx_v_length);

  /* "/home/jiba/src/soya/sound/sound.pyx":35 */
  memcpy(__pyx_v_chunk->content,PyString_AS_STRING(__pyx_v_string),__pyx_v_length);

  /* "/home/jiba/src/soya/sound/sound.pyx":36 */
  __pyx_v_chunk->nb = 0;

  /* "/home/jiba/src/soya/sound/sound.pyx":37 */
  __pyx_r = __pyx_v_chunk;
  goto __pyx_L0;

  goto __pyx_L0;
  __pyx_L1:;
  __Pyx_WriteUnraisable("_sound.string_to_chunk");
  __pyx_L0:;
  Py_DECREF(__pyx_v_string);
  return __pyx_r;
}

static PyObject *__pyx_n_AL_INVALID_NAME;
static PyObject *__pyx_n_AL_INVALID_ENUM;
static PyObject *__pyx_n_AL_INVALID_VALUE;
static PyObject *__pyx_n_AL_INVALID_OPERATION;
static PyObject *__pyx_n_AL_OUT_OF_MEMORY;
static PyObject *__pyx_n_ALC_INVALID_DEVICE;
static PyObject *__pyx_n_ALC_INVALID_CONTEXT;
static PyObject *__pyx_n_ALC_INVALID_ENUM;
static PyObject *__pyx_n_ALC_INVALID_VALUE;
static PyObject *__pyx_n_ALC_OUT_OF_MEMORY;


static PyObject *__pyx_f_6_sound_check_al_error(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6_sound_check_al_error[] = "check_al_error()\n\nChecks for OpenAL errors, and raise an ALError if so.";
static PyObject *__pyx_f_6_sound_check_al_error(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  ALenum __pyx_v_error;
  PyObject *__pyx_v_s;
  PyObject *__pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  static char *__pyx_argnames[] = {0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
  __pyx_v_s = Py_None; Py_INCREF(Py_None);

  /* "/home/jiba/src/soya/sound/sound.pyx":48 */
  __pyx_v_error = alGetError();

  /* "/home/jiba/src/soya/sound/sound.pyx":49 */
  __pyx_1 = (__pyx_v_error != AL_NO_ERROR);
  if (__pyx_1) {

    /* "/home/jiba/src/soya/sound/sound.pyx":50 */
    __pyx_1 = (__pyx_v_error == AL_INVALID_NAME);
    if (__pyx_1) {
      Py_INCREF(__pyx_n_AL_INVALID_NAME);
      Py_DECREF(__pyx_v_s);
      __pyx_v_s = __pyx_n_AL_INVALID_NAME;
      goto __pyx_L3;
    }
    __pyx_1 = (__pyx_v_error == AL_INVALID_ENUM);
    if (__pyx_1) {
      Py_INCREF(__pyx_n_AL_INVALID_ENUM);
      Py_DECREF(__pyx_v_s);
      __pyx_v_s = __pyx_n_AL_INVALID_ENUM;
      goto __pyx_L3;
    }
    __pyx_1 = (__pyx_v_error == AL_INVALID_VALUE);
    if (__pyx_1) {
      Py_INCREF(__pyx_n_AL_INVALID_VALUE);
      Py_DECREF(__pyx_v_s);
      __pyx_v_s = __pyx_n_AL_INVALID_VALUE;
      goto __pyx_L3;
    }
    __pyx_1 = (__pyx_v_error == AL_INVALID_OPERATION);
    if (__pyx_1) {
      Py_INCREF(__pyx_n_AL_INVALID_OPERATION);
      Py_DECREF(__pyx_v_s);
      __pyx_v_s = __pyx_n_AL_INVALID_OPERATION;
      goto __pyx_L3;
    }
    __pyx_1 = (__pyx_v_error == AL_OUT_OF_MEMORY);
    if (__pyx_1) {
      Py_INCREF(__pyx_n_AL_OUT_OF_MEMORY);
      Py_DECREF(__pyx_v_s);
      __pyx_v_s = __pyx_n_AL_OUT_OF_MEMORY;
      goto __pyx_L3;
    }
    __pyx_L3:;

    /* "/home/jiba/src/soya/sound/sound.pyx":55 */
    if (__Pyx_PrintItem(__pyx_v_s) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; goto __pyx_L1;}
    if (__Pyx_PrintNewline() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; goto __pyx_L1;}

    /* "/home/jiba/src/soya/sound/sound.pyx":56 */
    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_ALError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; goto __pyx_L1;}
    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; goto __pyx_L1;}
    Py_INCREF(__pyx_v_s);
    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_s);
    __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __Pyx_Raise(__pyx_4, 0, 0);
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; goto __pyx_L1;}
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/home/jiba/src/soya/sound/sound.pyx":58 */
  __pyx_v_error = alcGetError(__pyx_v_6_sound__device);

  /* "/home/jiba/src/soya/sound/sound.pyx":59 */
  __pyx_1 = (__pyx_v_error != ALC_NO_ERROR);
  if (__pyx_1) {

    /* "/home/jiba/src/soya/sound/sound.pyx":60 */
    __pyx_1 = (__pyx_v_error == ALC_INVALID_DEVICE);
    if (__pyx_1) {
      Py_INCREF(__pyx_n_ALC_INVALID_DEVICE);
      Py_DECREF(__pyx_v_s);
      __pyx_v_s = __pyx_n_ALC_INVALID_DEVICE;
      goto __pyx_L5;
    }
    __pyx_1 = (__pyx_v_error == ALC_INVALID_CONTEXT);
    if (__pyx_1) {
      Py_INCREF(__pyx_n_ALC_INVALID_CONTEXT);
      Py_DECREF(__pyx_v_s);
      __pyx_v_s = __pyx_n_ALC_INVALID_CONTEXT;
      goto __pyx_L5;
    }
    __pyx_1 = (__pyx_v_error == ALC_INVALID_ENUM);
    if (__pyx_1) {
      Py_INCREF(__pyx_n_ALC_INVALID_ENUM);
      Py_DECREF(__pyx_v_s);
      __pyx_v_s = __pyx_n_ALC_INVALID_ENUM;
      goto __pyx_L5;
    }
    __pyx_1 = (__pyx_v_error == ALC_INVALID_VALUE);
    if (__pyx_1) {
      Py_INCREF(__pyx_n_ALC_INVALID_VALUE);
      Py_DECREF(__pyx_v_s);
      __pyx_v_s = __pyx_n_ALC_INVALID_VALUE;
      goto __pyx_L5;
    }
    __pyx_1 = (__pyx_v_error == ALC_OUT_OF_MEMORY);
    if (__pyx_1) {
      Py_INCREF(__pyx_n_ALC_OUT_OF_MEMORY);
      Py_DECREF(__pyx_v_s);
      __pyx_v_s = __pyx_n_ALC_OUT_OF_MEMORY;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/home/jiba/src/soya/sound/sound.pyx":65 */
    if (__Pyx_PrintItem(__pyx_v_s) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; goto __pyx_L1;}
    if (__Pyx_PrintNewline() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; goto __pyx_L1;}

    /* "/home/jiba/src/soya/sound/sound.pyx":66 */
    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_ALError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; goto __pyx_L1;}
    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; goto __pyx_L1;}
    Py_INCREF(__pyx_v_s);
    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_s);
    __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __Pyx_Raise(__pyx_4, 0, 0);
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; goto __pyx_L1;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_4);
  __Pyx_AddTraceback("_sound.check_al_error");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_s);
  return __pyx_r;
}

static PyObject *__pyx_n_RuntimeError;

static PyObject *__pyx_k22p;
static PyObject *__pyx_k23p;
static PyObject *__pyx_k24p;
static PyObject *__pyx_k25p;

static char (__pyx_k22[]) = "Cannot create an OpenAL device!";
static char (__pyx_k23[]) = "Cannot create an OpenAL context!";
static char (__pyx_k24[]) = "* Soya * OpenAL device: %s";
static char (__pyx_k25[]) = "* Soya * OpenAL extension: %s";

static PyObject *__pyx_f_6_sound_init_sound(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6_sound_init_sound[] = "init_sound(EAR, DEVICE_NAMES = \"\'( ( devices \'( native esd sdl alsa arts null ) ) )\", FREQUENCY = 44100, DOPPLER_FACTOR = 0.01)\n\nInitializes Soya\'s sound support.\nEAR is the object from which sounds are listening (usually the camera).\n\nDEVICE_NAMES is the OpenAL device names, the default value should be nice.\n\nFREQUENCY is the sound frequency.\n\nDOPPLER_FACTOR can be used to increase or decrease the Doppler effect.";
static PyObject *__pyx_f_6_sound_init_sound(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_ear = 0;
  PyObject *__pyx_v_device_names = 0;
  PyObject *__pyx_v_frequency = 0;
  PyObject *__pyx_v_doppler_factor = 0;
  char (*__pyx_v_s);
  int (__pyx_v_attrs[6]);
  float (__pyx_v_orientation[6]);
  PyObject *__pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  ALfloat __pyx_5;
  static char *__pyx_argnames[] = {"ear","device_names","frequency","doppler_factor",0};
  __pyx_v_device_names = __pyx_k3;
  __pyx_v_frequency = __pyx_k4;
  __pyx_v_doppler_factor = __pyx_k5;
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O|OOO", __pyx_argnames, &__pyx_v_ear, &__pyx_v_device_names, &__pyx_v_frequency, &__pyx_v_doppler_factor)) return 0;
  Py_INCREF(__pyx_v_ear);
  Py_INCREF(__pyx_v_device_names);
  Py_INCREF(__pyx_v_frequency);
  Py_INCREF(__pyx_v_doppler_factor);

  /* "/home/jiba/src/soya/sound/sound.pyx":99 */
  __pyx_1 = (__pyx_v_6_sound__SOUND_INITED == 0);
  if (__pyx_1) {

    /* "/home/jiba/src/soya/sound/sound.pyx":101 */
    __pyx_v_6_sound__device = alcOpenDevice(PyString_AS_STRING(__pyx_v_device_names));

    /* "/home/jiba/src/soya/sound/sound.pyx":103 */
    __pyx_1 = (__pyx_v_6_sound__device == 0);
    if (__pyx_1) {

      /* "/home/jiba/src/soya/sound/sound.pyx":104 */
      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_RuntimeError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; goto __pyx_L1;}
      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; goto __pyx_L1;}
      Py_INCREF(__pyx_k22p);
      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k22p);
      __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; goto __pyx_L1;}
      Py_DECREF(__pyx_2); __pyx_2 = 0;
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      __Pyx_Raise(__pyx_4, 0, 0);
      Py_DECREF(__pyx_4); __pyx_4 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; goto __pyx_L1;}
      goto __pyx_L3;
    }
    __pyx_L3:;

    /* "/home/jiba/src/soya/sound/sound.pyx":106 */
    (__pyx_v_attrs[0]) = ALC_FREQUENCY;

    /* "/home/jiba/src/soya/sound/sound.pyx":107 */
    __pyx_1 = PyInt_AsLong(__pyx_v_frequency); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; goto __pyx_L1;}
    (__pyx_v_attrs[1]) = __pyx_1;

    /* "/home/jiba/src/soya/sound/sound.pyx":108 */
    (__pyx_v_attrs[2]) = ALC_INVALID;

    /* "/home/jiba/src/soya/sound/sound.pyx":109 */
    __pyx_v_6_sound__context = alcCreateContext(__pyx_v_6_sound__device,__pyx_v_attrs);

    /* "/home/jiba/src/soya/sound/sound.pyx":111 */
    __pyx_1 = (__pyx_v_6_sound__context == 0);
    if (__pyx_1) {

      /* "/home/jiba/src/soya/sound/sound.pyx":112 */
      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_RuntimeError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; goto __pyx_L1;}
      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; goto __pyx_L1;}
      Py_INCREF(__pyx_k23p);
      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k23p);
      __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; goto __pyx_L1;}
      Py_DECREF(__pyx_2); __pyx_2 = 0;
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      __Pyx_Raise(__pyx_4, 0, 0);
      Py_DECREF(__pyx_4); __pyx_4 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; goto __pyx_L1;}
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/jiba/src/soya/sound/sound.pyx":114 */
    alcMakeContextCurrent(__pyx_v_6_sound__context);

    /* "/home/jiba/src/soya/sound/sound.pyx":116 */
    __pyx_5 = PyFloat_AsDouble(__pyx_v_doppler_factor); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L1;}
    alDopplerFactor(__pyx_5);

    /* "/home/jiba/src/soya/sound/sound.pyx":118 */
    __pyx_v_6_sound__SOUND_INITED = 1;

    /* "/home/jiba/src/soya/sound/sound.pyx":120 */
    __pyx_v_s = alcGetString(__pyx_v_6_sound__device,ALC_DEVICE_SPECIFIER);

    /* "/home/jiba/src/soya/sound/sound.pyx":121 */
    __pyx_2 = PyString_FromString(__pyx_v_s); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; goto __pyx_L1;}
    __pyx_3 = PyNumber_Remainder(__pyx_k24p, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    if (__Pyx_PrintItem(__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    if (__Pyx_PrintNewline() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; goto __pyx_L1;}

    /* "/home/jiba/src/soya/sound/sound.pyx":123 */
    __pyx_v_s = alcGetString(__pyx_v_6_sound__device,ALC_EXTENSIONS);

    /* "/home/jiba/src/soya/sound/sound.pyx":124 */
    __pyx_4 = PyString_FromString(__pyx_v_s); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; goto __pyx_L1;}
    __pyx_2 = PyNumber_Remainder(__pyx_k25p, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; goto __pyx_L1;}
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    if (__Pyx_PrintItem(__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    if (__Pyx_PrintNewline() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; goto __pyx_L1;}
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/home/jiba/src/soya/sound/sound.pyx":127 */
  if (!__Pyx_TypeTest(__pyx_v_ear, __pyx_ptype_5_soya_CoordSyst)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}
  Py_INCREF(__pyx_v_ear);
  Py_DECREF(((PyObject *)__pyx_v_6_sound_EAR));
  __pyx_v_6_sound_EAR = ((struct __pyx_obj_5_soya_CoordSyst *)__pyx_v_ear);

  /* "/home/jiba/src/soya/sound/sound.pyx":130 */
  (__pyx_v_orientation[0]) = 0.0;

  /* "/home/jiba/src/soya/sound/sound.pyx":131 */
  (__pyx_v_orientation[1]) = 0.0;

  /* "/home/jiba/src/soya/sound/sound.pyx":132 */
  (__pyx_v_orientation[2]) = (-1.0);

  /* "/home/jiba/src/soya/sound/sound.pyx":133 */
  (__pyx_v_orientation[3]) = 0.0;

  /* "/home/jiba/src/soya/sound/sound.pyx":134 */
  (__pyx_v_orientation[4]) = 1.0;

  /* "/home/jiba/src/soya/sound/sound.pyx":135 */
  (__pyx_v_orientation[5]) = 0.0;

  /* "/home/jiba/src/soya/sound/sound.pyx":137 */
  alListener3f(AL_POSITION,0.0,0.0,0.0);

  /* "/home/jiba/src/soya/sound/sound.pyx":138 */
  alListener3f(AL_VELOCITY,0.0,0.0,0.0);

  /* "/home/jiba/src/soya/sound/sound.pyx":139 */
  alListenerfv(AL_ORIENTATION,__pyx_v_orientation);

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_4);
  __Pyx_AddTraceback("_sound.init_sound");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_ear);
  Py_DECREF(__pyx_v_device_names);
  Py_DECREF(__pyx_v_frequency);
  Py_DECREF(__pyx_v_doppler_factor);
  return __pyx_r;
}

static int __pyx_f_6_sound_6_Sound___new__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_f_6_sound_6_Sound___new__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kargs = 0;
  int __pyx_r;
  PyObject *__pyx_1 = 0;
  static char *__pyx_argnames[] = {0};
  if (__Pyx_GetStarArgs(&__pyx_args, &__pyx_kwds, __pyx_argnames, 0, &__pyx_v_args, &__pyx_v_kargs) < 0) return -1;
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) {
    Py_XDECREF(__pyx_args);
    Py_XDECREF(__pyx_kwds);
    Py_XDECREF(__pyx_v_args);
    Py_XDECREF(__pyx_v_kargs);
    return -1;
  }
  Py_INCREF((PyObject *)__pyx_v_self);

  /* "/home/jiba/src/soya/sound/sound.pyx":152 */
  __pyx_1 = PyList_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; goto __pyx_L1;}
  Py_DECREF(((struct __pyx_obj_6_sound__Sound *)__pyx_v_self)->_buffers);
  ((struct __pyx_obj_6_sound__Sound *)__pyx_v_self)->_buffers = __pyx_1;
  __pyx_1 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("_sound._Sound.__new__");
  __pyx_r = -1;
  __pyx_L0:;
  Py_XDECREF(__pyx_v_args);
  Py_XDECREF(__pyx_v_kargs);
  Py_DECREF((PyObject *)__pyx_v_self);
  Py_XDECREF(__pyx_args);
  Py_XDECREF(__pyx_kwds);
  return __pyx_r;
}

static void __pyx_f_6_sound_6_Sound___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_f_6_sound_6_Sound___dealloc__(PyObject *__pyx_v_self) {
  ALuint __pyx_v_buffer;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  ALuint __pyx_3;
  Py_INCREF((PyObject *)__pyx_v_self);

  /* "/home/jiba/src/soya/sound/sound.pyx":156 */
  __pyx_1 = PyObject_GetIter(((struct __pyx_obj_6_sound__Sound *)__pyx_v_self)->_buffers); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; goto __pyx_L1;}
  for (;;) {
    __pyx_L2:;
    __pyx_2 = PyIter_Next(__pyx_1);
    if (!__pyx_2) {
      if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; goto __pyx_L1;}
      break;
    }
    __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __pyx_v_buffer = __pyx_3;

    /* "/home/jiba/src/soya/sound/sound.pyx":157 */
    alDeleteBuffers(1,(&__pyx_v_buffer));
  }
  __pyx_L3:;
  Py_DECREF(__pyx_1); __pyx_1 = 0;

  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  __Pyx_AddTraceback("_sound._Sound.__dealloc__");
  __pyx_L0:;
  Py_DECREF((PyObject *)__pyx_v_self);
}

static PyObject *__pyx_n_NotImplementedError;

static ALuint __pyx_f_6_sound_6_Sound__getbuffer(struct __pyx_obj_6_sound__Sound *__pyx_v_self,PyObject *__pyx_v_i) {
  ALuint __pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  Py_INCREF((PyObject *)__pyx_v_self);
  Py_INCREF(__pyx_v_i);
  __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_NotImplementedError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; goto __pyx_L1;}
  __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; goto __pyx_L1;}
  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  __Pyx_Raise(__pyx_3, 0, 0);
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; goto __pyx_L1;}

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  __Pyx_WriteUnraisable("_sound._Sound._getbuffer");
  __pyx_L0:;
  Py_DECREF((PyObject *)__pyx_v_self);
  Py_DECREF(__pyx_v_i);
  return __pyx_r;
}

static PyObject *__pyx_f_6_sound_6_Sound_6stereo___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_f_6_sound_6_Sound_6stereo___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  Py_INCREF((PyObject *)__pyx_v_self);

  /* "/home/jiba/src/soya/sound/sound.pyx":163 */
  __pyx_1 = (((struct __pyx_obj_6_sound__Sound *)__pyx_v_self)->_format == AL_FORMAT_STEREO16);
  if (!__pyx_1) {
    __pyx_1 = (((struct __pyx_obj_6_sound__Sound *)__pyx_v_self)->_format == AL_FORMAT_STEREO8);
  }
  __pyx_2 = PyInt_FromLong(__pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; goto __pyx_L1;}
  __pyx_r = __pyx_2;
  __pyx_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  __Pyx_AddTraceback("_sound._Sound.stereo.__get__");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF((PyObject *)__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_n___class__;
static PyObject *__pyx_n___name__;

static PyObject *__pyx_k26p;

static char (__pyx_k26[]) = "<%s %s>";

static PyObject *__pyx_f_6_sound_6_Sound___repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_f_6_sound_6_Sound___repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  Py_INCREF((PyObject *)__pyx_v_self);

  /* "/home/jiba/src/soya/sound/sound.pyx":166 */
  __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n___class__); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; goto __pyx_L1;}
  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n___name__); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_1, 0, __pyx_2);
  Py_INCREF(((struct __pyx_obj_6_sound__Sound *)__pyx_v_self)->_filename);
  PyTuple_SET_ITEM(__pyx_1, 1, ((struct __pyx_obj_6_sound__Sound *)__pyx_v_self)->_filename);
  __pyx_2 = 0;
  __pyx_2 = PyNumber_Remainder(__pyx_k26p, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_r = __pyx_2;
  __pyx_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  __Pyx_AddTraceback("_sound._Sound.__repr__");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF((PyObject *)__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_n_wave;
static PyObject *__pyx_n_open;
static PyObject *__pyx_n_getnchannels;
static PyObject *__pyx_n_getsampwidth;
static PyObject *__pyx_n_getframerate;


static int __pyx_f_6_sound_9_WAVSound___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_f_6_sound_9_WAVSound___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  PyObject *__pyx_v_wave;
  int __pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  int __pyx_4;
  static char *__pyx_argnames[] = {"filename",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_filename)) return -1;
  Py_INCREF((PyObject *)__pyx_v_self);
  Py_INCREF(__pyx_v_filename);
  __pyx_v_wave = Py_None; Py_INCREF(Py_None);

  /* "/home/jiba/src/soya/sound/sound.pyx":171 */
  __pyx_1 = __Pyx_Import(__pyx_n_wave, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; goto __pyx_L1;}
  Py_DECREF(__pyx_v_wave);
  __pyx_v_wave = __pyx_1;
  __pyx_1 = 0;

  /* "/home/jiba/src/soya/sound/sound.pyx":172 */
  __pyx_1 = PyObject_GetAttr(__pyx_v_wave, __pyx_n_open); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; goto __pyx_L1;}
  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; goto __pyx_L1;}
  Py_INCREF(__pyx_v_filename);
  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_filename);
  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  Py_DECREF(((struct __pyx_obj_6_sound__WAVSound *)__pyx_v_self)->__pyx_base._file);
  ((struct __pyx_obj_6_sound__WAVSound *)__pyx_v_self)->__pyx_base._file = __pyx_3;
  __pyx_3 = 0;

  /* "/home/jiba/src/soya/sound/sound.pyx":174 */
  __pyx_1 = PyObject_GetAttr(((struct __pyx_obj_6_sound__WAVSound *)__pyx_v_self)->__pyx_base._file, __pyx_n_getnchannels); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; goto __pyx_L1;}
  __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; goto __pyx_L1;}
  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; goto __pyx_L1;}
  if (PyObject_Cmp(__pyx_3, __pyx_1, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; goto __pyx_L1;}
  __pyx_4 = __pyx_4 == 0;
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  if (__pyx_4) {

    /* "/home/jiba/src/soya/sound/sound.pyx":175 */
    __pyx_2 = PyObject_GetAttr(((struct __pyx_obj_6_sound__WAVSound *)__pyx_v_self)->__pyx_base._file, __pyx_n_getsampwidth); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; goto __pyx_L1;}
    __pyx_3 = PyTuple_New(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; goto __pyx_L1;}
    __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __pyx_2 = PyInt_FromLong(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; goto __pyx_L1;}
    if (PyObject_Cmp(__pyx_1, __pyx_2, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; goto __pyx_L1;}
    __pyx_4 = __pyx_4 == 0;
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    if (__pyx_4) {
      ((struct __pyx_obj_6_sound__WAVSound *)__pyx_v_self)->__pyx_base._format = AL_FORMAT_STEREO16;
      goto __pyx_L3;
    }
    /*else*/ {
      ((struct __pyx_obj_6_sound__WAVSound *)__pyx_v_self)->__pyx_base._format = AL_FORMAT_STEREO8;
    }
    __pyx_L3:;
    goto __pyx_L2;
  }
  /*else*/ {

    /* "/home/jiba/src/soya/sound/sound.pyx":178 */
    __pyx_3 = PyObject_GetAttr(((struct __pyx_obj_6_sound__WAVSound *)__pyx_v_self)->__pyx_base._file, __pyx_n_getsampwidth); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}
    __pyx_1 = PyTuple_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}
    __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    __pyx_3 = PyInt_FromLong(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}
    if (PyObject_Cmp(__pyx_2, __pyx_3, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}
    __pyx_4 = __pyx_4 == 0;
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    if (__pyx_4) {
      ((struct __pyx_obj_6_sound__WAVSound *)__pyx_v_self)->__pyx_base._format = AL_FORMAT_MONO16;
      goto __pyx_L4;
    }
    /*else*/ {
      ((struct __pyx_obj_6_sound__WAVSound *)__pyx_v_self)->__pyx_base._format = AL_FORMAT_MONO8;
    }
    __pyx_L4:;
  }
  __pyx_L2:;

  /* "/home/jiba/src/soya/sound/sound.pyx":180 */
  __pyx_1 = PyObject_GetAttr(((struct __pyx_obj_6_sound__WAVSound *)__pyx_v_self)->__pyx_base._file, __pyx_n_getframerate); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; goto __pyx_L1;}
  __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; goto __pyx_L1;}
  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  ((struct __pyx_obj_6_sound__WAVSound *)__pyx_v_self)->__pyx_base._framerate = __pyx_4;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  __Pyx_AddTraceback("_sound._WAVSound.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  Py_DECREF(__pyx_v_wave);
  Py_DECREF((PyObject *)__pyx_v_self);
  Py_DECREF(__pyx_v_filename);
  return __pyx_r;
}

static PyObject *__pyx_n_readframes;

static PyObject *__pyx_f_6_sound_9_WAVSound__getnextdata(struct __pyx_obj_6_sound__WAVSound *__pyx_v_self) {
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  Py_INCREF((PyObject *)__pyx_v_self);

  /* "/home/jiba/src/soya/sound/sound.pyx":183 */
  __pyx_1 = PyObject_GetAttr(__pyx_v_self->__pyx_base._file, __pyx_n_readframes); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; goto __pyx_L1;}
  __pyx_2 = PyInt_FromLong((1024 * 64)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; goto __pyx_L1;}
  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
  __pyx_2 = 0;
  __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  __pyx_r = __pyx_2;
  __pyx_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  __Pyx_AddTraceback("_sound._WAVSound._getnextdata");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF((PyObject *)__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_n_append;

static ALuint __pyx_f_6_sound_9_WAVSound__getbuffer(struct __pyx_obj_6_sound__WAVSound *__pyx_v_self,PyObject *__pyx_v_i) {
  int __pyx_v_length;
  PyObject *__pyx_v_data;
  ALuint __pyx_v_buffer;
  ALuint __pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  ALuint __pyx_3;
  PyObject *__pyx_4 = 0;
  PyObject *__pyx_5 = 0;
  Py_INCREF((PyObject *)__pyx_v_self);
  Py_INCREF(__pyx_v_i);
  __pyx_v_data = Py_None; Py_INCREF(Py_None);

  /* "/home/jiba/src/soya/sound/sound.pyx":186 */
  __pyx_1 = PyObject_Length(__pyx_v_self->__pyx_base._buffers); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; goto __pyx_L1;}
  __pyx_2 = PyInt_FromLong(__pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; goto __pyx_L1;}
  if (PyObject_Cmp(__pyx_v_i, __pyx_2, &__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; goto __pyx_L1;}
  __pyx_1 = __pyx_1 < 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  if (__pyx_1) {
    __pyx_2 = PyObject_GetItem(__pyx_v_self->__pyx_base._buffers, __pyx_v_i); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; goto __pyx_L1;}
    __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __pyx_r = __pyx_3;
    goto __pyx_L0;
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/home/jiba/src/soya/sound/sound.pyx":188 */
  __pyx_1 = __pyx_v_self->__pyx_base._file == Py_None;
  if (__pyx_1) {
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/jiba/src/soya/sound/sound.pyx":190 */
  __pyx_1 = PyObject_Length(__pyx_v_self->__pyx_base._buffers); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; goto __pyx_L1;}
  __pyx_2 = PyInt_FromLong(__pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; goto __pyx_L1;}
  if (PyObject_Cmp(__pyx_v_i, __pyx_2, &__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; goto __pyx_L1;}
  __pyx_1 = __pyx_1 > 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  if (__pyx_1) {
    __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; goto __pyx_L1;}
    __pyx_4 = PyNumber_Subtract(__pyx_v_i, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    ((struct __pyx_vtabstruct_6_sound__WAVSound *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base._getbuffer(((struct __pyx_obj_6_sound__Sound *)__pyx_v_self),__pyx_4);
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/jiba/src/soya/sound/sound.pyx":193 */
  __pyx_2 = ((struct __pyx_vtabstruct_6_sound__WAVSound *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->_getnextdata(__pyx_v_self); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;}
  Py_DECREF(__pyx_v_data);
  __pyx_v_data = __pyx_2;
  __pyx_2 = 0;

  /* "/home/jiba/src/soya/sound/sound.pyx":194 */
  __pyx_1 = PyObject_Length(__pyx_v_data); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}
  __pyx_v_length = __pyx_1;

  /* "/home/jiba/src/soya/sound/sound.pyx":196 */
  __pyx_1 = (__pyx_v_length == 0);
  if (__pyx_1) {

    /* "/home/jiba/src/soya/sound/sound.pyx":197 */
    Py_INCREF(Py_None);
    Py_DECREF(__pyx_v_self->__pyx_base._file);
    __pyx_v_self->__pyx_base._file = Py_None;

    /* "/home/jiba/src/soya/sound/sound.pyx":198 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/jiba/src/soya/sound/sound.pyx":201 */
  alGenBuffers(1,(&__pyx_v_buffer));

  /* "/home/jiba/src/soya/sound/sound.pyx":202 */
  alBufferData(__pyx_v_buffer,__pyx_v_self->__pyx_base._format,PyString_AS_STRING(__pyx_v_data),__pyx_v_length,__pyx_v_self->__pyx_base._framerate);

  /* "/home/jiba/src/soya/sound/sound.pyx":203 */
  __pyx_4 = PyObject_GetAttr(__pyx_v_self->__pyx_base._buffers, __pyx_n_append); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; goto __pyx_L1;}
  __pyx_2 = PyLong_FromUnsignedLong(__pyx_v_buffer); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; goto __pyx_L1;}
  __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_5, 0, __pyx_2);
  __pyx_2 = 0;
  __pyx_2 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; goto __pyx_L1;}
  Py_DECREF(__pyx_4); __pyx_4 = 0;
  Py_DECREF(__pyx_5); __pyx_5 = 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;

  /* "/home/jiba/src/soya/sound/sound.pyx":205 */
  __pyx_r = __pyx_v_buffer;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_4);
  Py_XDECREF(__pyx_5);
  __Pyx_WriteUnraisable("_sound._WAVSound._getbuffer");
  __pyx_L0:;
  Py_DECREF(__pyx_v_data);
  Py_DECREF((PyObject *)__pyx_v_self);
  Py_DECREF(__pyx_v_i);
  return __pyx_r;
}

static PyObject *__pyx_n_vorbis;
static PyObject *__pyx_n_VorbisFile;
static PyObject *__pyx_n_info;
static PyObject *__pyx_n_channels;
static PyObject *__pyx_n_rate;

static PyObject *__pyx_k28p;

static char (__pyx_k28[]) = "ogg.vorbis";

static int __pyx_f_6_sound_15_OGGVorbisSound___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_f_6_sound_15_OGGVorbisSound___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  PyObject *__pyx_v_ogg;
  PyObject *__pyx_v_info;
  int __pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  int __pyx_4;
  static char *__pyx_argnames[] = {"filename",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_filename)) return -1;
  Py_INCREF((PyObject *)__pyx_v_self);
  Py_INCREF(__pyx_v_filename);
  __pyx_v_ogg = Py_None; Py_INCREF(Py_None);
  __pyx_v_info = Py_None; Py_INCREF(Py_None);

  /* "/home/jiba/src/soya/sound/sound.pyx":211 */
  __pyx_1 = __Pyx_Import(__pyx_k28p, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; goto __pyx_L1;}
  Py_DECREF(__pyx_v_ogg);
  __pyx_v_ogg = __pyx_1;
  __pyx_1 = 0;

  /* "/home/jiba/src/soya/sound/sound.pyx":213 */
  __pyx_1 = PyObject_GetAttr(__pyx_v_ogg, __pyx_n_vorbis); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; goto __pyx_L1;}
  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_VorbisFile); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; goto __pyx_L1;}
  Py_INCREF(__pyx_v_filename);
  PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_filename);
  __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(((struct __pyx_obj_6_sound__OGGVorbisSound *)__pyx_v_self)->__pyx_base._file);
  ((struct __pyx_obj_6_sound__OGGVorbisSound *)__pyx_v_self)->__pyx_base._file = __pyx_3;
  __pyx_3 = 0;

  /* "/home/jiba/src/soya/sound/sound.pyx":214 */
  __pyx_2 = PyObject_GetAttr(((struct __pyx_obj_6_sound__OGGVorbisSound *)__pyx_v_self)->__pyx_base._file, __pyx_n_info); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; goto __pyx_L1;}
  __pyx_1 = PyTuple_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; goto __pyx_L1;}
  __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_v_info);
  __pyx_v_info = __pyx_3;
  __pyx_3 = 0;

  /* "/home/jiba/src/soya/sound/sound.pyx":216 */
  __pyx_2 = PyObject_GetAttr(__pyx_v_info, __pyx_n_channels); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; goto __pyx_L1;}
  __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; goto __pyx_L1;}
  if (PyObject_Cmp(__pyx_2, __pyx_1, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; goto __pyx_L1;}
  __pyx_4 = __pyx_4 == 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  if (__pyx_4) {
    ((struct __pyx_obj_6_sound__OGGVorbisSound *)__pyx_v_self)->__pyx_base._format = AL_FORMAT_STEREO16;
    goto __pyx_L2;
  }
  /*else*/ {
    ((struct __pyx_obj_6_sound__OGGVorbisSound *)__pyx_v_self)->__pyx_base._format = AL_FORMAT_MONO16;
  }
  __pyx_L2:;

  /* "/home/jiba/src/soya/sound/sound.pyx":218 */
  __pyx_3 = PyObject_GetAttr(__pyx_v_info, __pyx_n_rate); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; goto __pyx_L1;}
  __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  ((struct __pyx_obj_6_sound__OGGVorbisSound *)__pyx_v_self)->__pyx_base._framerate = __pyx_4;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  __Pyx_AddTraceback("_sound._OGGVorbisSound.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  Py_DECREF(__pyx_v_ogg);
  Py_DECREF(__pyx_v_info);
  Py_DECREF((PyObject *)__pyx_v_self);
  Py_DECREF(__pyx_v_filename);
  return __pyx_r;
}

static PyObject *__pyx_n_StringIO;
static PyObject *__pyx_n_pcm_seek;
static PyObject *__pyx_n_read;
static PyObject *__pyx_n_write;
static PyObject *__pyx_n_getvalue;

static PyObject *__pyx_k30p;

static char (__pyx_k30[]) = "";

static PyObject *__pyx_f_6_sound_15_OGGVorbisSound__getdata(struct __pyx_obj_6_sound__OGGVorbisSound *__pyx_v_self,int __pyx_v_i) {
  int __pyx_v_length;
  PyObject *__pyx_v_StringIO;
  PyObject *__pyx_v_s;
  PyObject *__pyx_v_data;
  PyObject *__pyx_v_bytes;
  PyObject *__pyx_v_bit;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  int __pyx_4;
  PyObject *__pyx_5 = 0;
  Py_INCREF((PyObject *)__pyx_v_self);
  __pyx_v_StringIO = Py_None; Py_INCREF(Py_None);
  __pyx_v_s = Py_None; Py_INCREF(Py_None);
  __pyx_v_data = Py_None; Py_INCREF(Py_None);
  __pyx_v_bytes = Py_None; Py_INCREF(Py_None);
  __pyx_v_bit = Py_None; Py_INCREF(Py_None);

  /* "/home/jiba/src/soya/sound/sound.pyx":223 */
  __pyx_1 = __Pyx_Import(__pyx_n_StringIO, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; goto __pyx_L1;}
  Py_DECREF(__pyx_v_StringIO);
  __pyx_v_StringIO = __pyx_1;
  __pyx_1 = 0;

  /* "/home/jiba/src/soya/sound/sound.pyx":225 */
  /*try:*/ {
    __pyx_1 = PyObject_GetAttr(__pyx_v_self->__pyx_base._file, __pyx_n_pcm_seek); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; goto __pyx_L2;}
    __pyx_2 = PyInt_FromLong(((__pyx_v_i * 16384) / 2)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; goto __pyx_L2;}
    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; goto __pyx_L2;}
    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
    __pyx_2 = 0;
    __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; goto __pyx_L2;}
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    Py_DECREF(__pyx_2); __pyx_2 = 0;
  }
  goto __pyx_L3;
  __pyx_L2:;
  Py_XDECREF(__pyx_1); __pyx_1 = 0;
  Py_XDECREF(__pyx_3); __pyx_3 = 0;
  Py_XDECREF(__pyx_2); __pyx_2 = 0;

  /* "/home/jiba/src/soya/sound/sound.pyx":226 */
  /*except:*/ {
    __Pyx_AddTraceback("_sound._getdata");
    __pyx_1 = __Pyx_GetExcValue(); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    Py_INCREF(__pyx_k30p);
    __pyx_r = __pyx_k30p;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/jiba/src/soya/sound/sound.pyx":228 */
  __pyx_3 = PyObject_GetAttr(__pyx_v_StringIO, __pyx_n_StringIO); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; goto __pyx_L1;}
  __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; goto __pyx_L1;}
  __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  Py_DECREF(__pyx_v_s);
  __pyx_v_s = __pyx_1;
  __pyx_1 = 0;

  /* "/home/jiba/src/soya/sound/sound.pyx":229 */
  __pyx_v_length = 16384;

  /* "/home/jiba/src/soya/sound/sound.pyx":230 */
  while (1) {
    __pyx_L4:;
    __pyx_4 = (__pyx_v_length > 0);
    if (!__pyx_4) break;

    /* "/home/jiba/src/soya/sound/sound.pyx":231 */
    __pyx_3 = PyObject_GetAttr(__pyx_v_self->__pyx_base._file, __pyx_n_read); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;}
    __pyx_2 = PyInt_FromLong(__pyx_v_length); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;}
    __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_1, 0, __pyx_2);
    __pyx_2 = 0;
    __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    __pyx_3 = __Pyx_UnpackItem(__pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;}
    Py_DECREF(__pyx_v_data);
    __pyx_v_data = __pyx_3;
    __pyx_3 = 0;
    __pyx_1 = __Pyx_UnpackItem(__pyx_2, 1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;}
    Py_DECREF(__pyx_v_bytes);
    __pyx_v_bytes = __pyx_1;
    __pyx_1 = 0;
    __pyx_5 = __Pyx_UnpackItem(__pyx_2, 2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;}
    Py_DECREF(__pyx_v_bit);
    __pyx_v_bit = __pyx_5;
    __pyx_5 = 0;
    if (__Pyx_EndUnpack(__pyx_2, 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;

    /* "/home/jiba/src/soya/sound/sound.pyx":232 */
    __pyx_3 = PyInt_FromLong(__pyx_v_length); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; goto __pyx_L1;}
    __pyx_1 = PyNumber_Subtract(__pyx_3, __pyx_v_bytes); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __pyx_4 = PyInt_AsLong(__pyx_1); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; goto __pyx_L1;}
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    __pyx_v_length = __pyx_4;

    /* "/home/jiba/src/soya/sound/sound.pyx":233 */
    __pyx_5 = PyObject_GetAttr(__pyx_v_s, __pyx_n_write); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; goto __pyx_L1;}
    __pyx_4 = PyInt_AsLong(__pyx_v_bytes); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; goto __pyx_L1;}
    __pyx_2 = PySequence_GetSlice(__pyx_v_data, 0, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; goto __pyx_L1;}
    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
    __pyx_2 = 0;
    __pyx_1 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; goto __pyx_L1;}
    Py_DECREF(__pyx_5); __pyx_5 = 0;
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    Py_DECREF(__pyx_1); __pyx_1 = 0;

    /* "/home/jiba/src/soya/sound/sound.pyx":234 */
    __pyx_4 = PyObject_IsTrue(__pyx_v_bit); if (__pyx_4 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; goto __pyx_L1;}
    if (__pyx_4) {
      goto __pyx_L5;
      goto __pyx_L6;
    }
    __pyx_L6:;
  }
  __pyx_L5:;

  /* "/home/jiba/src/soya/sound/sound.pyx":236 */
  __pyx_2 = PyObject_GetAttr(__pyx_v_s, __pyx_n_getvalue); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; goto __pyx_L1;}
  __pyx_5 = PyTuple_New(0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; goto __pyx_L1;}
  __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  Py_DECREF(__pyx_5); __pyx_5 = 0;
  __pyx_r = __pyx_3;
  __pyx_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_5);
  __Pyx_AddTraceback("_sound._OGGVorbisSound._getdata");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_StringIO);
  Py_DECREF(__pyx_v_s);
  Py_DECREF(__pyx_v_data);
  Py_DECREF(__pyx_v_bytes);
  Py_DECREF(__pyx_v_bit);
  Py_DECREF((PyObject *)__pyx_v_self);
  return __pyx_r;
}

static ALuint __pyx_f_6_sound_15_OGGVorbisSound__getbuffer(struct __pyx_obj_6_sound__OGGVorbisSound *__pyx_v_self,PyObject *__pyx_v_i) {
  int __pyx_v_j;
  int __pyx_v_length;
  PyObject *__pyx_v_data;
  ALuint __pyx_v_buffer;
  ALuint __pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  ALuint __pyx_5;
  Py_INCREF((PyObject *)__pyx_v_self);
  Py_INCREF(__pyx_v_i);
  __pyx_v_data = Py_None; Py_INCREF(Py_None);

  /* "/home/jiba/src/soya/sound/sound.pyx":241 */
  while (1) {
    __pyx_L2:;
    __pyx_1 = PyObject_Length(__pyx_v_self->__pyx_base._buffers); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; goto __pyx_L1;}
    __pyx_2 = PyInt_FromLong(__pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; goto __pyx_L1;}
    if (PyObject_Cmp(__pyx_v_i, __pyx_2, &__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; goto __pyx_L1;}
    __pyx_1 = __pyx_1 >= 0;
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    if (!__pyx_1) break;
    __pyx_2 = PyObject_GetAttr(__pyx_v_self->__pyx_base._buffers, __pyx_n_append); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; goto __pyx_L1;}
    __pyx_3 = PyInt_FromLong(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; goto __pyx_L1;}
    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
    __pyx_3 = 0;
    __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    Py_DECREF(__pyx_3); __pyx_3 = 0;
  }
  __pyx_L3:;

  /* "/home/jiba/src/soya/sound/sound.pyx":243 */
  __pyx_2 = PyObject_GetItem(__pyx_v_self->__pyx_base._buffers, __pyx_v_i); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; goto __pyx_L1;}
  __pyx_4 = PyInt_FromLong(0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; goto __pyx_L1;}
  if (PyObject_Cmp(__pyx_2, __pyx_4, &__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; goto __pyx_L1;}
  __pyx_1 = __pyx_1 != 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  Py_DECREF(__pyx_4); __pyx_4 = 0;
  if (__pyx_1) {
    __pyx_3 = PyObject_GetItem(__pyx_v_self->__pyx_base._buffers, __pyx_v_i); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; goto __pyx_L1;}
    __pyx_5 = PyInt_AsUnsignedLongMask(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __pyx_r = __pyx_5;
    goto __pyx_L0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/jiba/src/soya/sound/sound.pyx":245 */
  __pyx_1 = __pyx_v_self->__pyx_base._file == Py_None;
  if (__pyx_1) {
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/jiba/src/soya/sound/sound.pyx":248 */
  __pyx_1 = PyInt_AsLong(__pyx_v_i); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; goto __pyx_L1;}
  __pyx_2 = ((struct __pyx_vtabstruct_6_sound__OGGVorbisSound *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->_getdata(__pyx_v_self,__pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; goto __pyx_L1;}
  Py_DECREF(__pyx_v_data);
  __pyx_v_data = __pyx_2;
  __pyx_2 = 0;

  /* "/home/jiba/src/soya/sound/sound.pyx":249 */
  __pyx_1 = PyObject_Length(__pyx_v_data); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; goto __pyx_L1;}
  __pyx_v_length = __pyx_1;

  /* "/home/jiba/src/soya/sound/sound.pyx":251 */
  __pyx_1 = (__pyx_v_length == 0);
  if (__pyx_1) {

    /* "/home/jiba/src/soya/sound/sound.pyx":252 */
    __pyx_4 = PyObject_GetIter(__pyx_v_self->__pyx_base._buffers); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; goto __pyx_L1;}
    for (;;) {
      __pyx_L7:;
      __pyx_3 = PyIter_Next(__pyx_4);
      if (!__pyx_3) {
        if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; goto __pyx_L1;}
        break;
      }
      __pyx_1 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; goto __pyx_L1;}
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      __pyx_v_j = __pyx_1;

      /* "/home/jiba/src/soya/sound/sound.pyx":253 */
      __pyx_1 = (__pyx_v_j == 0);
      if (__pyx_1) {
        goto __pyx_L8;
        goto __pyx_L9;
      }
      __pyx_L9:;
    }
    /*else*/ {

      /* "/home/jiba/src/soya/sound/sound.pyx":255 */
      Py_INCREF(Py_None);
      Py_DECREF(__pyx_v_self->__pyx_base._file);
      __pyx_v_self->__pyx_base._file = Py_None;
    }
    __pyx_L8:;
    Py_DECREF(__pyx_4); __pyx_4 = 0;

    /* "/home/jiba/src/soya/sound/sound.pyx":256 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/jiba/src/soya/sound/sound.pyx":259 */
  alGenBuffers(1,(&__pyx_v_buffer));

  /* "/home/jiba/src/soya/sound/sound.pyx":260 */
  alBufferData(__pyx_v_buffer,__pyx_v_self->__pyx_base._format,PyString_AS_STRING(__pyx_v_data),__pyx_v_length,__pyx_v_self->__pyx_base._framerate);

  /* "/home/jiba/src/soya/sound/sound.pyx":261 */
  __pyx_2 = PyLong_FromUnsignedLong(__pyx_v_buffer); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; goto __pyx_L1;}
  if (PyObject_SetItem(__pyx_v_self->__pyx_base._buffers, __pyx_v_i, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;

  /* "/home/jiba/src/soya/sound/sound.pyx":263 */
  __pyx_r = __pyx_v_buffer;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_4);
  __Pyx_WriteUnraisable("_sound._OGGVorbisSound._getbuffer");
  __pyx_L0:;
  Py_DECREF(__pyx_v_data);
  Py_DECREF((PyObject *)__pyx_v_self);
  Py_DECREF(__pyx_v_i);
  return __pyx_r;
}

static int __pyx_f_6_sound_12_SoundPlayer___new__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_f_6_sound_12_SoundPlayer___new__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kargs = 0;
  int __pyx_r;
  static char *__pyx_argnames[] = {0};
  if (__Pyx_GetStarArgs(&__pyx_args, &__pyx_kwds, __pyx_argnames, 0, &__pyx_v_args, &__pyx_v_kargs) < 0) return -1;
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) {
    Py_XDECREF(__pyx_args);
    Py_XDECREF(__pyx_kwds);
    Py_XDECREF(__pyx_v_args);
    Py_XDECREF(__pyx_v_kargs);
    return -1;
  }
  Py_INCREF((PyObject *)__pyx_v_self);

  /* "/home/jiba/src/soya/sound/sound.pyx":275 */
  alGenSources(1,(&((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_source));

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  __Pyx_AddTraceback("_sound._SoundPlayer.__new__");
  __pyx_r = -1;
  __pyx_L0:;
  Py_XDECREF(__pyx_v_args);
  Py_XDECREF(__pyx_v_kargs);
  Py_DECREF((PyObject *)__pyx_v_self);
  Py_XDECREF(__pyx_args);
  Py_XDECREF(__pyx_kwds);
  return __pyx_r;
}

static void __pyx_f_6_sound_12_SoundPlayer___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_f_6_sound_12_SoundPlayer___dealloc__(PyObject *__pyx_v_self) {
  Py_INCREF((PyObject *)__pyx_v_self);

  /* "/home/jiba/src/soya/sound/sound.pyx":278 */
  alDeleteSources(1,(&((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_source));

  goto __pyx_L0;
  __pyx_L1:;
  __Pyx_AddTraceback("_sound._SoundPlayer.__dealloc__");
  __pyx_L0:;
  Py_DECREF((PyObject *)__pyx_v_self);
}

static PyObject *__pyx_n___init__;
static PyObject *__pyx_n_stereo;
static PyObject *__pyx_n_ValueError;

static PyObject *__pyx_k31p;

static char (__pyx_k31[]) = "OpenAL cannot play stereo sound as 3D sound!";

static int __pyx_f_6_sound_12_SoundPlayer___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_f_6_sound_12_SoundPlayer___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5_soya__World *__pyx_v_parent = 0;
  struct __pyx_obj_6_sound__Sound *__pyx_v_sound = 0;
  int __pyx_v_loop;
  int __pyx_v_play_in_3D;
  float __pyx_v_gain;
  int __pyx_v_auto_remove;
  int __pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  int __pyx_4;
  int __pyx_5;
  static char *__pyx_argnames[] = {"parent","sound","loop","play_in_3D","gain","auto_remove",0};
  __pyx_v_parent = __pyx_k6;
  __pyx_v_sound = __pyx_k7;
  __pyx_v_loop = __pyx_k8;
  __pyx_v_play_in_3D = __pyx_k9;
  __pyx_v_gain = __pyx_k10;
  __pyx_v_auto_remove = __pyx_k11;
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "|OOiifi", __pyx_argnames, &__pyx_v_parent, &__pyx_v_sound, &__pyx_v_loop, &__pyx_v_play_in_3D, &__pyx_v_gain, &__pyx_v_auto_remove)) return -1;
  Py_INCREF((PyObject *)__pyx_v_self);
  Py_INCREF((PyObject *)__pyx_v_parent);
  Py_INCREF((PyObject *)__pyx_v_sound);
  if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parent), __pyx_ptype_5_soya__World, 1, "parent")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; goto __pyx_L1;}
  if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sound), __pyx_ptype_6_sound__Sound, 1, "sound")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; goto __pyx_L1;}

  /* "/home/jiba/src/soya/sound/sound.pyx":281 */
  __pyx_1 = PyObject_GetAttr(((PyObject*)__pyx_ptype_5_soya_CoordSyst), __pyx_n___init__); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; goto __pyx_L1;}
  __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; goto __pyx_L1;}
  Py_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_self);
  Py_INCREF(((PyObject *)__pyx_v_parent));
  PyTuple_SET_ITEM(__pyx_2, 1, ((PyObject *)__pyx_v_parent));
  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  Py_DECREF(__pyx_3); __pyx_3 = 0;

  /* "/home/jiba/src/soya/sound/sound.pyx":282 */
  Py_INCREF(((PyObject *)__pyx_v_sound));
  Py_DECREF(((PyObject *)((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_sound));
  ((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_sound = __pyx_v_sound;

  /* "/home/jiba/src/soya/sound/sound.pyx":283 */
  alSourcef(((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_source,AL_GAIN,__pyx_v_gain);

  /* "/home/jiba/src/soya/sound/sound.pyx":285 */
  __pyx_4 = __pyx_v_loop;
  if (__pyx_4) {
    ((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->__pyx_base._option = (((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->__pyx_base._option | __pyx_e_5_soya_SOUND_LOOP);
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/home/jiba/src/soya/sound/sound.pyx":286 */
  __pyx_4 = __pyx_v_auto_remove;
  if (__pyx_4) {
    ((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->__pyx_base._option = (((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->__pyx_base._option | __pyx_e_5_soya_SOUND_AUTO_REMOVE);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/jiba/src/soya/sound/sound.pyx":288 */
  __pyx_4 = __pyx_v_play_in_3D;
  if (__pyx_4) {

    /* "/home/jiba/src/soya/sound/sound.pyx":289 */
    ((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->__pyx_base._option = (((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->__pyx_base._option | __pyx_e_5_soya_SOUND_PLAY_IN_3D);

    /* "/home/jiba/src/soya/sound/sound.pyx":291 */
    ((struct __pyx_vtabstruct_6_sound__SoundPlayer *)((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._into(((struct __pyx_obj_5_soya_Position *)__pyx_v_self),__pyx_v_6_sound_EAR,((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_old_pos);

    /* "/home/jiba/src/soya/sound/sound.pyx":292 */
    alSourcefv(((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_source,AL_POSITION,((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_old_pos);
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/jiba/src/soya/sound/sound.pyx":294 */
  __pyx_4 = __pyx_v_sound == Py_None;
  __pyx_5 = (!__pyx_4);
  if (__pyx_5) {

    /* "/home/jiba/src/soya/sound/sound.pyx":295 */
    __pyx_1 = PyInt_FromLong(__pyx_v_play_in_3D); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; goto __pyx_L1;}
    __pyx_4 = PyObject_IsTrue(__pyx_1); if (__pyx_4 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; goto __pyx_L1;}
    if (__pyx_4) {
      Py_DECREF(__pyx_1); __pyx_1 = 0;
      __pyx_1 = PyObject_GetAttr(((PyObject *)__pyx_v_sound), __pyx_n_stereo); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; goto __pyx_L1;}
    }
    __pyx_5 = PyObject_IsTrue(__pyx_1); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; goto __pyx_L1;}
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    if (__pyx_5) {
      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; goto __pyx_L1;}
      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; goto __pyx_L1;}
      Py_INCREF(__pyx_k31p);
      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k31p);
      __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; goto __pyx_L1;}
      Py_DECREF(__pyx_2); __pyx_2 = 0;
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      __Pyx_Raise(__pyx_1, 0, 0);
      Py_DECREF(__pyx_1); __pyx_1 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; goto __pyx_L1;}
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "/home/jiba/src/soya/sound/sound.pyx":297 */
    ((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_current_buffer_id = 0;

    /* "/home/jiba/src/soya/sound/sound.pyx":298 */
    __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; goto __pyx_L1;}
    ((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_current_buffer = ((struct __pyx_vtabstruct_6_sound__Sound *)__pyx_v_sound->__pyx_base.__pyx_vtab)->_getbuffer(__pyx_v_sound,__pyx_2);
    Py_DECREF(__pyx_2); __pyx_2 = 0;

    /* "/home/jiba/src/soya/sound/sound.pyx":299 */
    alSourceQueueBuffers(((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_source,1,(&((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_current_buffer));

    /* "/home/jiba/src/soya/sound/sound.pyx":301 */
    __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; goto __pyx_L1;}
    ((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_pending_buffer = ((struct __pyx_vtabstruct_6_sound__Sound *)__pyx_v_sound->__pyx_base.__pyx_vtab)->_getbuffer(__pyx_v_sound,__pyx_3);
    Py_DECREF(__pyx_3); __pyx_3 = 0;

    /* "/home/jiba/src/soya/sound/sound.pyx":302 */
    __pyx_4 = (((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_pending_buffer == 0);
    if (__pyx_4) {
      ((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_pending_buffer = ((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_current_buffer;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "/home/jiba/src/soya/sound/sound.pyx":303 */
    alSourceQueueBuffers(((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_source,1,(&((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_pending_buffer));

    /* "/home/jiba/src/soya/sound/sound.pyx":305 */
    alSourcePlay(((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_source);
    goto __pyx_L5;
  }
  __pyx_L5:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  __Pyx_AddTraceback("_sound._SoundPlayer.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  Py_DECREF((PyObject *)__pyx_v_self);
  Py_DECREF((PyObject *)__pyx_v_parent);
  Py_DECREF((PyObject *)__pyx_v_sound);
  return __pyx_r;
}

static PyObject *__pyx_f_6_sound_12_SoundPlayer___getcstate__(struct __pyx_obj_6_sound__SoundPlayer *__pyx_v_self) {
  float __pyx_v_x;
  __pyx_t_5_soya_Chunk (*__pyx_v_chunk);
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  Py_INCREF((PyObject *)__pyx_v_self);

  /* "/home/jiba/src/soya/sound/sound.pyx":311 */
  __pyx_v_chunk = get_chunk();

  /* "/home/jiba/src/soya/sound/sound.pyx":312 */
  chunk_add_int_endian_safe(__pyx_v_chunk,__pyx_v_self->__pyx_base._option);

  /* "/home/jiba/src/soya/sound/sound.pyx":313 */
  chunk_add_floats_endian_safe(__pyx_v_chunk,__pyx_v_self->__pyx_base._matrix,19);

  /* "/home/jiba/src/soya/sound/sound.pyx":314 */
  chunk_add_floats_endian_safe(__pyx_v_chunk,__pyx_v_self->_old_pos,3);

  /* "/home/jiba/src/soya/sound/sound.pyx":315 */
  chunk_add_int_endian_safe(__pyx_v_chunk,__pyx_v_self->_current_buffer_id);

  /* "/home/jiba/src/soya/sound/sound.pyx":317 */
  alGetSourcef(__pyx_v_self->_source,AL_GAIN,(&__pyx_v_x));

  /* "/home/jiba/src/soya/sound/sound.pyx":318 */
  chunk_add_float_endian_safe(__pyx_v_chunk,__pyx_v_x);

  /* "/home/jiba/src/soya/sound/sound.pyx":320 */
  __pyx_1 = __pyx_f_6_sound_drop_chunk_to_string(__pyx_v_chunk); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; goto __pyx_L1;}
  __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_1);
  Py_INCREF(((PyObject *)__pyx_v_self->_sound));
  PyTuple_SET_ITEM(__pyx_2, 1, ((PyObject *)__pyx_v_self->_sound));
  __pyx_1 = 0;
  __pyx_r = __pyx_2;
  __pyx_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  __Pyx_AddTraceback("_sound._SoundPlayer.__getcstate__");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF((PyObject *)__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_n_COORDSYS_INVALID;

static void __pyx_f_6_sound_12_SoundPlayer___setcstate__(struct __pyx_obj_6_sound__SoundPlayer *__pyx_v_self,PyObject *__pyx_v_cstate) {
  __pyx_t_5_soya_Chunk (*__pyx_v_chunk);
  float __pyx_v_x;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  int __pyx_3;
  Py_INCREF((PyObject *)__pyx_v_self);
  Py_INCREF(__pyx_v_cstate);

  /* "/home/jiba/src/soya/sound/sound.pyx":323 */
  __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; goto __pyx_L1;}
  __pyx_2 = PyObject_GetItem(__pyx_v_cstate, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  if (!__Pyx_TypeTest(__pyx_2, __pyx_ptype_6_sound__Sound)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; goto __pyx_L1;}
  Py_DECREF(((PyObject *)__pyx_v_self->_sound));
  __pyx_v_self->_sound = __pyx_2;
  __pyx_2 = 0;

  /* "/home/jiba/src/soya/sound/sound.pyx":325 */
  __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; goto __pyx_L1;}
  __pyx_2 = PyObject_GetItem(__pyx_v_cstate, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_v_cstate);
  __pyx_v_cstate = __pyx_2;
  __pyx_2 = 0;

  /* "/home/jiba/src/soya/sound/sound.pyx":327 */
  __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_COORDSYS_INVALID); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; goto __pyx_L1;}
  __pyx_3 = PyInt_AsLong(__pyx_1); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_v_self->__pyx_base._validity = __pyx_3;

  /* "/home/jiba/src/soya/sound/sound.pyx":330 */
  __pyx_v_chunk = __pyx_f_6_sound_string_to_chunk(__pyx_v_cstate);

  /* "/home/jiba/src/soya/sound/sound.pyx":331 */
  chunk_get_int_endian_safe(__pyx_v_chunk,(&__pyx_v_self->__pyx_base._option));

  /* "/home/jiba/src/soya/sound/sound.pyx":332 */
  chunk_get_floats_endian_safe(__pyx_v_chunk,__pyx_v_self->__pyx_base._matrix,19);

  /* "/home/jiba/src/soya/sound/sound.pyx":333 */
  chunk_get_floats_endian_safe(__pyx_v_chunk,__pyx_v_self->_old_pos,3);

  /* "/home/jiba/src/soya/sound/sound.pyx":334 */
  chunk_get_int_endian_safe(__pyx_v_chunk,(&__pyx_v_self->_current_buffer_id));

  /* "/home/jiba/src/soya/sound/sound.pyx":336 */
  chunk_get_float_endian_safe(__pyx_v_chunk,(&__pyx_v_x));

  /* "/home/jiba/src/soya/sound/sound.pyx":337 */
  alSourcef(__pyx_v_self->_source,AL_GAIN,__pyx_v_x);

  /* "/home/jiba/src/soya/sound/sound.pyx":339 */
  drop_chunk(__pyx_v_chunk);

  /* "/home/jiba/src/soya/sound/sound.pyx":341 */
  __pyx_3 = (__pyx_v_self->__pyx_base._option & __pyx_e_5_soya_SOUND_PLAY_IN_3D);
  if (__pyx_3) {

    /* "/home/jiba/src/soya/sound/sound.pyx":342 */
    alSourcefv(__pyx_v_self->_source,AL_POSITION,__pyx_v_self->_old_pos);
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/home/jiba/src/soya/sound/sound.pyx":344 */
  __pyx_3 = PyObject_IsTrue(((PyObject *)__pyx_v_self->_sound)); if (__pyx_3 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; goto __pyx_L1;}
  if (__pyx_3) {

    /* "/home/jiba/src/soya/sound/sound.pyx":345 */
    __pyx_2 = PyInt_FromLong(__pyx_v_self->_current_buffer_id); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; goto __pyx_L1;}
    __pyx_v_self->_current_buffer = ((struct __pyx_vtabstruct_6_sound__Sound *)__pyx_v_self->_sound->__pyx_base.__pyx_vtab)->_getbuffer(__pyx_v_self->_sound,__pyx_2);
    Py_DECREF(__pyx_2); __pyx_2 = 0;

    /* "/home/jiba/src/soya/sound/sound.pyx":346 */
    alSourceQueueBuffers(__pyx_v_self->_source,1,(&__pyx_v_self->_current_buffer));

    /* "/home/jiba/src/soya/sound/sound.pyx":348 */
    __pyx_1 = PyInt_FromLong((__pyx_v_self->_current_buffer_id + 1)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; goto __pyx_L1;}
    __pyx_v_self->_pending_buffer = ((struct __pyx_vtabstruct_6_sound__Sound *)__pyx_v_self->_sound->__pyx_base.__pyx_vtab)->_getbuffer(__pyx_v_self->_sound,__pyx_1);
    Py_DECREF(__pyx_1); __pyx_1 = 0;

    /* "/home/jiba/src/soya/sound/sound.pyx":349 */
    __pyx_3 = (__pyx_v_self->_pending_buffer == 0);
    if (__pyx_3) {
      __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}
      __pyx_v_self->_pending_buffer = ((struct __pyx_vtabstruct_6_sound__Sound *)__pyx_v_self->_sound->__pyx_base.__pyx_vtab)->_getbuffer(__pyx_v_self->_sound,__pyx_2);
      Py_DECREF(__pyx_2); __pyx_2 = 0;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/jiba/src/soya/sound/sound.pyx":350 */
    alSourceQueueBuffers(__pyx_v_self->_source,1,(&__pyx_v_self->_pending_buffer));

    /* "/home/jiba/src/soya/sound/sound.pyx":352 */
    alSourcePlay(__pyx_v_self->_source);
    goto __pyx_L3;
  }
  __pyx_L3:;

  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  __Pyx_WriteUnraisable("_sound._SoundPlayer.__setcstate__");
  __pyx_L0:;
  Py_DECREF((PyObject *)__pyx_v_self);
  Py_DECREF(__pyx_v_cstate);
}

static PyObject *__pyx_n_begin_round;
static PyObject *__pyx_n_ended;

static PyObject *__pyx_f_6_sound_12_SoundPlayer_begin_round(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_6_sound_12_SoundPlayer_begin_round(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_i;
  int __pyx_v_nb_queued;
  int __pyx_v_nb_processed;
  ALuint __pyx_v_buffer;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  int __pyx_4;
  static char *__pyx_argnames[] = {0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
  Py_INCREF((PyObject *)__pyx_v_self);

  /* "/home/jiba/src/soya/sound/sound.pyx":355 */
  __pyx_1 = PyObject_GetAttr(((PyObject*)__pyx_ptype_5_soya_CoordSyst), __pyx_n_begin_round); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; goto __pyx_L1;}
  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; goto __pyx_L1;}
  Py_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_self);
  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  Py_DECREF(__pyx_3); __pyx_3 = 0;

  /* "/home/jiba/src/soya/sound/sound.pyx":360 */
  __pyx_4 = (!(((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->__pyx_base._option & __pyx_e_5_soya_SOUND_LOOP));
  if (__pyx_4) {

    /* "/home/jiba/src/soya/sound/sound.pyx":361 */
    alGetSourcei(((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_source,AL_SOURCE_STATE,(&__pyx_v_i));

    /* "/home/jiba/src/soya/sound/sound.pyx":362 */
    __pyx_4 = (__pyx_v_i == AL_STOPPED);
    if (__pyx_4) {
      __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_ended); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; goto __pyx_L1;}
      __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; goto __pyx_L1;}
      __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; goto __pyx_L1;}
      Py_DECREF(__pyx_1); __pyx_1 = 0;
      Py_DECREF(__pyx_2); __pyx_2 = 0;
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      goto __pyx_L3;
    }
    __pyx_L3:;
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/home/jiba/src/soya/sound/sound.pyx":364 */
  alGetSourcei(((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_source,AL_BUFFERS_QUEUED,(&__pyx_v_nb_queued));

  /* "/home/jiba/src/soya/sound/sound.pyx":365 */
  alGetSourcei(((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_source,AL_BUFFERS_PROCESSED,(&__pyx_v_nb_processed));

  /* "/home/jiba/src/soya/sound/sound.pyx":367 */
  __pyx_4 = (__pyx_v_nb_processed >= 1);
  if (__pyx_4) {

    /* "/home/jiba/src/soya/sound/sound.pyx":368 */
    alSourceUnqueueBuffers(((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_source,1,(&((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_current_buffer));

    /* "/home/jiba/src/soya/sound/sound.pyx":370 */
    ((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_current_buffer = ((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_pending_buffer;

    /* "/home/jiba/src/soya/sound/sound.pyx":372 */
    __pyx_1 = PyLong_FromUnsignedLong(((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_current_buffer); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; goto __pyx_L1;}
    __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; goto __pyx_L1;}
    __pyx_3 = PyObject_GetItem(((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_sound->_buffers, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    if (PyObject_Cmp(__pyx_1, __pyx_3, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; goto __pyx_L1;}
    __pyx_4 = __pyx_4 == 0;
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    if (__pyx_4) {
      ((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_current_buffer_id = 0;
      goto __pyx_L5;
    }
    /*else*/ {
      ((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_current_buffer_id = (((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_current_buffer_id + 1);
    }
    __pyx_L5:;

    /* "/home/jiba/src/soya/sound/sound.pyx":375 */
    __pyx_2 = PyInt_FromLong((((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_current_buffer_id + 1)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; goto __pyx_L1;}
    ((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_pending_buffer = ((struct __pyx_vtabstruct_6_sound__Sound *)((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_sound->__pyx_base.__pyx_vtab)->_getbuffer(((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_sound,__pyx_2);
    Py_DECREF(__pyx_2); __pyx_2 = 0;

    /* "/home/jiba/src/soya/sound/sound.pyx":377 */
    __pyx_4 = (((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_pending_buffer == 0);
    if (__pyx_4) {

      /* "/home/jiba/src/soya/sound/sound.pyx":378 */
      __pyx_4 = (((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->__pyx_base._option & __pyx_e_5_soya_SOUND_LOOP);
      if (__pyx_4) {
        __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; goto __pyx_L1;}
        ((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_pending_buffer = ((struct __pyx_vtabstruct_6_sound__Sound *)((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_sound->__pyx_base.__pyx_vtab)->_getbuffer(((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_sound,__pyx_1);
        Py_DECREF(__pyx_1); __pyx_1 = 0;
        goto __pyx_L7;
      }
      /*else*/ {
        __pyx_r = Py_None; Py_INCREF(Py_None);
        goto __pyx_L0;
      }
      __pyx_L7:;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "/home/jiba/src/soya/sound/sound.pyx":381 */
    alSourceQueueBuffers(((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_source,1,(&((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_pending_buffer));
    goto __pyx_L4;
  }
  __pyx_L4:;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  __Pyx_AddTraceback("_sound._SoundPlayer.begin_round");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF((PyObject *)__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_n_IDLER;
static PyObject *__pyx_n_round_duration;

static PyObject *__pyx_f_6_sound_12_SoundPlayer_advance_time(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_6_sound_12_SoundPlayer_advance_time(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  float __pyx_v_proportion;
  float (__pyx_v_pos[3]);
  float __pyx_v_dt;
  PyObject *__pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  float __pyx_5;
  static char *__pyx_argnames[] = {"proportion",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "f", __pyx_argnames, &__pyx_v_proportion)) return 0;
  Py_INCREF((PyObject *)__pyx_v_self);

  /* "/home/jiba/src/soya/sound/sound.pyx":391 */
  __pyx_1 = (((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->__pyx_base._option & __pyx_e_5_soya_SOUND_PLAY_IN_3D);
  if (__pyx_1) {

    /* "/home/jiba/src/soya/sound/sound.pyx":392 */
    __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_IDLER); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; goto __pyx_L1;}
    __pyx_1 = __pyx_2 == Py_None;
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    if (__pyx_1) {
      __pyx_v_dt = (__pyx_v_proportion * 0.030);
      goto __pyx_L3;
    }
    /*else*/ {
      __pyx_2 = PyFloat_FromDouble(__pyx_v_proportion); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; goto __pyx_L1;}
      __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_IDLER); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; goto __pyx_L1;}
      __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_round_duration); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; goto __pyx_L1;}
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      __pyx_3 = PyNumber_Multiply(__pyx_2, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; goto __pyx_L1;}
      Py_DECREF(__pyx_2); __pyx_2 = 0;
      Py_DECREF(__pyx_4); __pyx_4 = 0;
      __pyx_5 = PyFloat_AsDouble(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; goto __pyx_L1;}
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      __pyx_v_dt = __pyx_5;
    }
    __pyx_L3:;

    /* "/home/jiba/src/soya/sound/sound.pyx":395 */
    ((struct __pyx_vtabstruct_6_sound__SoundPlayer *)((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._into(((struct __pyx_obj_5_soya_Position *)__pyx_v_self),__pyx_v_6_sound_EAR,__pyx_v_pos);

    /* "/home/jiba/src/soya/sound/sound.pyx":396 */
    alSourcefv(((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_source,AL_POSITION,__pyx_v_pos);

    /* "/home/jiba/src/soya/sound/sound.pyx":397 */
    alSource3f(((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_source,AL_VELOCITY,(((__pyx_v_pos[0]) - (((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_old_pos[0])) / __pyx_v_dt),(((__pyx_v_pos[1]) - (((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_old_pos[1])) / __pyx_v_dt),(((__pyx_v_pos[2]) - (((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_old_pos[2])) / __pyx_v_dt));

    /* "/home/jiba/src/soya/sound/sound.pyx":403 */
    memcpy(((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_old_pos,__pyx_v_pos,(3 * (sizeof(float ))));
    goto __pyx_L2;
  }
  __pyx_L2:;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_4);
  __Pyx_AddTraceback("_sound._SoundPlayer.advance_time");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF((PyObject *)__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_f_6_sound_12_SoundPlayer_5sound___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_f_6_sound_12_SoundPlayer_5sound___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r;
  Py_INCREF((PyObject *)__pyx_v_self);

  /* "/home/jiba/src/soya/sound/sound.pyx":407 */
  Py_INCREF(((PyObject *)((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_sound));
  __pyx_r = ((PyObject *)((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_sound);
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  __Pyx_AddTraceback("_sound._SoundPlayer.sound.__get__");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF((PyObject *)__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_f_6_sound_12_SoundPlayer_4loop___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_f_6_sound_12_SoundPlayer_4loop___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  Py_INCREF((PyObject *)__pyx_v_self);

  /* "/home/jiba/src/soya/sound/sound.pyx":411 */
  __pyx_1 = PyInt_FromLong((((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->__pyx_base._option & __pyx_e_5_soya_SOUND_LOOP)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; goto __pyx_L1;}
  __pyx_r = __pyx_1;
  __pyx_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("_sound._SoundPlayer.loop.__get__");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF((PyObject *)__pyx_v_self);
  return __pyx_r;
}

static int __pyx_f_6_sound_12_SoundPlayer_4loop___set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x); /*proto*/
static int __pyx_f_6_sound_12_SoundPlayer_4loop___set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x) {
  int __pyx_v_x;
  int __pyx_r;
  int __pyx_1;
  Py_INCREF((PyObject *)__pyx_v_self);
  __pyx_v_x = PyInt_AsLong(__pyx_arg_x); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; goto __pyx_L1;}

  /* "/home/jiba/src/soya/sound/sound.pyx":413 */
  __pyx_1 = __pyx_v_x;
  if (__pyx_1) {
    ((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->__pyx_base._option = (((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->__pyx_base._option | __pyx_e_5_soya_SOUND_LOOP);
    goto __pyx_L2;
  }
  /*else*/ {
    ((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->__pyx_base._option = (((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->__pyx_base._option & (~__pyx_e_5_soya_SOUND_LOOP));
  }
  __pyx_L2:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  __Pyx_AddTraceback("_sound._SoundPlayer.loop.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  Py_DECREF((PyObject *)__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_f_6_sound_12_SoundPlayer_11auto_remove___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_f_6_sound_12_SoundPlayer_11auto_remove___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  Py_INCREF((PyObject *)__pyx_v_self);

  /* "/home/jiba/src/soya/sound/sound.pyx":418 */
  __pyx_1 = PyInt_FromLong((((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->__pyx_base._option & __pyx_e_5_soya_SOUND_AUTO_REMOVE)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; goto __pyx_L1;}
  __pyx_r = __pyx_1;
  __pyx_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("_sound._SoundPlayer.auto_remove.__get__");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF((PyObject *)__pyx_v_self);
  return __pyx_r;
}

static int __pyx_f_6_sound_12_SoundPlayer_11auto_remove___set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x); /*proto*/
static int __pyx_f_6_sound_12_SoundPlayer_11auto_remove___set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x) {
  int __pyx_v_x;
  int __pyx_r;
  int __pyx_1;
  Py_INCREF((PyObject *)__pyx_v_self);
  __pyx_v_x = PyInt_AsLong(__pyx_arg_x); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; goto __pyx_L1;}

  /* "/home/jiba/src/soya/sound/sound.pyx":420 */
  __pyx_1 = __pyx_v_x;
  if (__pyx_1) {
    ((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->__pyx_base._option = (((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->__pyx_base._option | __pyx_e_5_soya_SOUND_AUTO_REMOVE);
    goto __pyx_L2;
  }
  /*else*/ {
    ((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->__pyx_base._option = (((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->__pyx_base._option & (~__pyx_e_5_soya_SOUND_AUTO_REMOVE));
  }
  __pyx_L2:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  __Pyx_AddTraceback("_sound._SoundPlayer.auto_remove.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  Py_DECREF((PyObject *)__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_f_6_sound_12_SoundPlayer_10play_in_3D___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_f_6_sound_12_SoundPlayer_10play_in_3D___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  Py_INCREF((PyObject *)__pyx_v_self);

  /* "/home/jiba/src/soya/sound/sound.pyx":425 */
  __pyx_1 = PyInt_FromLong((((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->__pyx_base._option & __pyx_e_5_soya_SOUND_PLAY_IN_3D)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; goto __pyx_L1;}
  __pyx_r = __pyx_1;
  __pyx_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("_sound._SoundPlayer.play_in_3D.__get__");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF((PyObject *)__pyx_v_self);
  return __pyx_r;
}

static int __pyx_f_6_sound_12_SoundPlayer_10play_in_3D___set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x); /*proto*/
static int __pyx_f_6_sound_12_SoundPlayer_10play_in_3D___set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x) {
  int __pyx_v_x;
  int __pyx_r;
  int __pyx_1;
  Py_INCREF((PyObject *)__pyx_v_self);
  __pyx_v_x = PyInt_AsLong(__pyx_arg_x); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; goto __pyx_L1;}

  /* "/home/jiba/src/soya/sound/sound.pyx":427 */
  __pyx_1 = __pyx_v_x;
  if (__pyx_1) {
    ((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->__pyx_base._option = (((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->__pyx_base._option | __pyx_e_5_soya_SOUND_PLAY_IN_3D);
    goto __pyx_L2;
  }
  /*else*/ {
    ((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->__pyx_base._option = (((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->__pyx_base._option & (~__pyx_e_5_soya_SOUND_PLAY_IN_3D));
  }
  __pyx_L2:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  __Pyx_AddTraceback("_sound._SoundPlayer.play_in_3D.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  Py_DECREF((PyObject *)__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_f_6_sound_12_SoundPlayer_4gain___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_f_6_sound_12_SoundPlayer_4gain___get__(PyObject *__pyx_v_self) {
  float __pyx_v_x;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  Py_INCREF((PyObject *)__pyx_v_self);

  /* "/home/jiba/src/soya/sound/sound.pyx":433 */
  alGetSourcef(((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_source,AL_GAIN,(&__pyx_v_x));

  /* "/home/jiba/src/soya/sound/sound.pyx":434 */
  __pyx_1 = PyFloat_FromDouble(__pyx_v_x); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; goto __pyx_L1;}
  __pyx_r = __pyx_1;
  __pyx_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("_sound._SoundPlayer.gain.__get__");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF((PyObject *)__pyx_v_self);
  return __pyx_r;
}

static int __pyx_f_6_sound_12_SoundPlayer_4gain___set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x); /*proto*/
static int __pyx_f_6_sound_12_SoundPlayer_4gain___set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x) {
  float __pyx_v_x;
  int __pyx_r;
  Py_INCREF((PyObject *)__pyx_v_self);
  __pyx_v_x = PyFloat_AsDouble(__pyx_arg_x); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; goto __pyx_L1;}

  /* "/home/jiba/src/soya/sound/sound.pyx":436 */
  alSourcef(((struct __pyx_obj_6_sound__SoundPlayer *)__pyx_v_self)->_source,AL_GAIN,__pyx_v_x);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  __Pyx_AddTraceback("_sound._SoundPlayer.gain.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  Py_DECREF((PyObject *)__pyx_v_self);
  return __pyx_r;
}

static __Pyx_InternTabEntry __pyx_intern_tab[] = {
  {&__pyx_n_ALC_INVALID_CONTEXT, "ALC_INVALID_CONTEXT"},
  {&__pyx_n_ALC_INVALID_DEVICE, "ALC_INVALID_DEVICE"},
  {&__pyx_n_ALC_INVALID_ENUM, "ALC_INVALID_ENUM"},
  {&__pyx_n_ALC_INVALID_VALUE, "ALC_INVALID_VALUE"},
  {&__pyx_n_ALC_OUT_OF_MEMORY, "ALC_OUT_OF_MEMORY"},
  {&__pyx_n_ALError, "ALError"},
  {&__pyx_n_AL_INVALID_ENUM, "AL_INVALID_ENUM"},
  {&__pyx_n_AL_INVALID_NAME, "AL_INVALID_NAME"},
  {&__pyx_n_AL_INVALID_OPERATION, "AL_INVALID_OPERATION"},
  {&__pyx_n_AL_INVALID_VALUE, "AL_INVALID_VALUE"},
  {&__pyx_n_AL_OUT_OF_MEMORY, "AL_OUT_OF_MEMORY"},
  {&__pyx_n_COORDSYS_INVALID, "COORDSYS_INVALID"},
  {&__pyx_n_IDLER, "IDLER"},
  {&__pyx_n_NotImplementedError, "NotImplementedError"},
  {&__pyx_n_RuntimeError, "RuntimeError"},
  {&__pyx_n_StandardError, "StandardError"},
  {&__pyx_n_StringIO, "StringIO"},
  {&__pyx_n_ValueError, "ValueError"},
  {&__pyx_n_VorbisFile, "VorbisFile"},
  {&__pyx_n___class__, "__class__"},
  {&__pyx_n___init__, "__init__"},
  {&__pyx_n___name__, "__name__"},
  {&__pyx_n__soya, "_soya"},
  {&__pyx_n_append, "append"},
  {&__pyx_n_begin_round, "begin_round"},
  {&__pyx_n_channels, "channels"},
  {&__pyx_n_check_al_error, "check_al_error"},
  {&__pyx_n_ended, "ended"},
  {&__pyx_n_getframerate, "getframerate"},
  {&__pyx_n_getnchannels, "getnchannels"},
  {&__pyx_n_getsampwidth, "getsampwidth"},
  {&__pyx_n_getvalue, "getvalue"},
  {&__pyx_n_info, "info"},
  {&__pyx_n_init_sound, "init_sound"},
  {&__pyx_n_open, "open"},
  {&__pyx_n_pcm_seek, "pcm_seek"},
  {&__pyx_n_rate, "rate"},
  {&__pyx_n_read, "read"},
  {&__pyx_n_readframes, "readframes"},
  {&__pyx_n_round_duration, "round_duration"},
  {&__pyx_n_stereo, "stereo"},
  {&__pyx_n_vorbis, "vorbis"},
  {&__pyx_n_wave, "wave"},
  {&__pyx_n_write, "write"},
  {0, 0}
};

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_k2p, __pyx_k2, sizeof(__pyx_k2)},
  {&__pyx_k22p, __pyx_k22, sizeof(__pyx_k22)},
  {&__pyx_k23p, __pyx_k23, sizeof(__pyx_k23)},
  {&__pyx_k24p, __pyx_k24, sizeof(__pyx_k24)},
  {&__pyx_k25p, __pyx_k25, sizeof(__pyx_k25)},
  {&__pyx_k26p, __pyx_k26, sizeof(__pyx_k26)},
  {&__pyx_k28p, __pyx_k28, sizeof(__pyx_k28)},
  {&__pyx_k30p, __pyx_k30, sizeof(__pyx_k30)},
  {&__pyx_k31p, __pyx_k31, sizeof(__pyx_k31)},
  {0, 0, 0}
};
static struct __pyx_vtabstruct_6_sound__Sound __pyx_vtable_6_sound__Sound;

static PyObject *__pyx_tp_new_6_sound__Sound(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o = __pyx_ptype_5_soya__CObj->tp_new(t, a, k);
  struct __pyx_obj_6_sound__Sound *p = (struct __pyx_obj_6_sound__Sound *)o;
  *(struct __pyx_vtabstruct_6_sound__Sound **)&p->__pyx_base.__pyx_vtab = __pyx_vtabptr_6_sound__Sound;
  p->_filename = Py_None; Py_INCREF(Py_None);
  p->_buffers = Py_None; Py_INCREF(Py_None);
  p->_file = Py_None; Py_INCREF(Py_None);
  if (__pyx_f_6_sound_6_Sound___new__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6_sound__Sound(PyObject *o) {
  struct __pyx_obj_6_sound__Sound *p = (struct __pyx_obj_6_sound__Sound *)o;
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++o->ob_refcnt;
    __pyx_f_6_sound_6_Sound___dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    --o->ob_refcnt;
    PyErr_Restore(etype, eval, etb);
  }
  Py_XDECREF(p->_filename);
  Py_XDECREF(p->_buffers);
  Py_XDECREF(p->_file);
  __pyx_ptype_5_soya__CObj->tp_dealloc(o);
}

static int __pyx_tp_traverse_6_sound__Sound(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6_sound__Sound *p = (struct __pyx_obj_6_sound__Sound *)o;
  e = __pyx_ptype_5_soya__CObj->tp_traverse(o, v, a); if (e) return e;
  if (p->_filename) {
    e = (*v)(p->_filename, a); if (e) return e;
  }
  if (p->_buffers) {
    e = (*v)(p->_buffers, a); if (e) return e;
  }
  if (p->_file) {
    e = (*v)(p->_file, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6_sound__Sound(PyObject *o) {
  struct __pyx_obj_6_sound__Sound *p = (struct __pyx_obj_6_sound__Sound *)o;
  __pyx_ptype_5_soya__CObj->tp_clear(o);
  Py_XDECREF(p->_filename);
  p->_filename = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(p->_buffers);
  p->_buffers = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(p->_file);
  p->_file = Py_None; Py_INCREF(Py_None);
  return 0;
}

static PyObject *__pyx_getprop_6_sound_6_Sound_stereo(PyObject *o, void *x) {
  return __pyx_f_6_sound_6_Sound_6stereo___get__(o);
}

static struct PyMethodDef __pyx_methods_6_sound__Sound[] = {
  {0, 0, 0, 0}
};

static struct PyMemberDef __pyx_members_6_sound__Sound[] = {
  {"_filename", T_OBJECT, offsetof(struct __pyx_obj_6_sound__Sound, _filename), 0, 0},
  {0, 0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6_sound__Sound[] = {
  {"stereo", __pyx_getprop_6_sound_6_Sound_stereo, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__Sound = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  0, /*nb_divide*/
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  0, /*nb_coerce*/
  0, /*nb_int*/
  0, /*nb_long*/
  0, /*nb_float*/
  0, /*nb_oct*/
  0, /*nb_hex*/
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  0, /*nb_inplace_divide*/
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
};

static PySequenceMethods __pyx_tp_as_sequence__Sound = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__Sound = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__Sound = {
  0, /*bf_getreadbuffer*/
  0, /*bf_getwritebuffer*/
  0, /*bf_getsegcount*/
  0, /*bf_getcharbuffer*/
};

PyTypeObject __pyx_type_6_sound__Sound = {
  PyObject_HEAD_INIT(0)
  0, /*ob_size*/
  "_sound._Sound", /*tp_name*/
  sizeof(struct __pyx_obj_6_sound__Sound), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6_sound__Sound, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_compare*/
  __pyx_f_6_sound_6_Sound___repr__, /*tp_repr*/
  &__pyx_tp_as_number__Sound, /*tp_as_number*/
  &__pyx_tp_as_sequence__Sound, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__Sound, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__Sound, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6_sound__Sound, /*tp_traverse*/
  __pyx_tp_clear_6_sound__Sound, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6_sound__Sound, /*tp_methods*/
  __pyx_members_6_sound__Sound, /*tp_members*/
  __pyx_getsets_6_sound__Sound, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6_sound__Sound, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
};
static struct __pyx_vtabstruct_6_sound__WAVSound __pyx_vtable_6_sound__WAVSound;

static PyObject *__pyx_tp_new_6_sound__WAVSound(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o = __pyx_ptype_6_sound__Sound->tp_new(t, a, k);
  struct __pyx_obj_6_sound__WAVSound *p = (struct __pyx_obj_6_sound__WAVSound *)o;
  *(struct __pyx_vtabstruct_6_sound__WAVSound **)&p->__pyx_base.__pyx_base.__pyx_vtab = __pyx_vtabptr_6_sound__WAVSound;
  return o;
}

static void __pyx_tp_dealloc_6_sound__WAVSound(PyObject *o) {
  struct __pyx_obj_6_sound__WAVSound *p = (struct __pyx_obj_6_sound__WAVSound *)o;
  __pyx_ptype_6_sound__Sound->tp_dealloc(o);
}

static int __pyx_tp_traverse_6_sound__WAVSound(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6_sound__WAVSound *p = (struct __pyx_obj_6_sound__WAVSound *)o;
  e = __pyx_ptype_6_sound__Sound->tp_traverse(o, v, a); if (e) return e;
  return 0;
}

static int __pyx_tp_clear_6_sound__WAVSound(PyObject *o) {
  struct __pyx_obj_6_sound__WAVSound *p = (struct __pyx_obj_6_sound__WAVSound *)o;
  __pyx_ptype_6_sound__Sound->tp_clear(o);
  return 0;
}

static struct PyMethodDef __pyx_methods_6_sound__WAVSound[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__WAVSound = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  0, /*nb_divide*/
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  0, /*nb_coerce*/
  0, /*nb_int*/
  0, /*nb_long*/
  0, /*nb_float*/
  0, /*nb_oct*/
  0, /*nb_hex*/
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  0, /*nb_inplace_divide*/
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
};

static PySequenceMethods __pyx_tp_as_sequence__WAVSound = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__WAVSound = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__WAVSound = {
  0, /*bf_getreadbuffer*/
  0, /*bf_getwritebuffer*/
  0, /*bf_getsegcount*/
  0, /*bf_getcharbuffer*/
};

PyTypeObject __pyx_type_6_sound__WAVSound = {
  PyObject_HEAD_INIT(0)
  0, /*ob_size*/
  "_sound._WAVSound", /*tp_name*/
  sizeof(struct __pyx_obj_6_sound__WAVSound), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6_sound__WAVSound, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_compare*/
  0, /*tp_repr*/
  &__pyx_tp_as_number__WAVSound, /*tp_as_number*/
  &__pyx_tp_as_sequence__WAVSound, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__WAVSound, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__WAVSound, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6_sound__WAVSound, /*tp_traverse*/
  __pyx_tp_clear_6_sound__WAVSound, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6_sound__WAVSound, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_f_6_sound_9_WAVSound___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6_sound__WAVSound, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
};
static struct __pyx_vtabstruct_6_sound__OGGVorbisSound __pyx_vtable_6_sound__OGGVorbisSound;

static PyObject *__pyx_tp_new_6_sound__OGGVorbisSound(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o = __pyx_ptype_6_sound__Sound->tp_new(t, a, k);
  struct __pyx_obj_6_sound__OGGVorbisSound *p = (struct __pyx_obj_6_sound__OGGVorbisSound *)o;
  *(struct __pyx_vtabstruct_6_sound__OGGVorbisSound **)&p->__pyx_base.__pyx_base.__pyx_vtab = __pyx_vtabptr_6_sound__OGGVorbisSound;
  return o;
}

static void __pyx_tp_dealloc_6_sound__OGGVorbisSound(PyObject *o) {
  struct __pyx_obj_6_sound__OGGVorbisSound *p = (struct __pyx_obj_6_sound__OGGVorbisSound *)o;
  __pyx_ptype_6_sound__Sound->tp_dealloc(o);
}

static int __pyx_tp_traverse_6_sound__OGGVorbisSound(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6_sound__OGGVorbisSound *p = (struct __pyx_obj_6_sound__OGGVorbisSound *)o;
  e = __pyx_ptype_6_sound__Sound->tp_traverse(o, v, a); if (e) return e;
  return 0;
}

static int __pyx_tp_clear_6_sound__OGGVorbisSound(PyObject *o) {
  struct __pyx_obj_6_sound__OGGVorbisSound *p = (struct __pyx_obj_6_sound__OGGVorbisSound *)o;
  __pyx_ptype_6_sound__Sound->tp_clear(o);
  return 0;
}

static struct PyMethodDef __pyx_methods_6_sound__OGGVorbisSound[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__OGGVorbisSound = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  0, /*nb_divide*/
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  0, /*nb_coerce*/
  0, /*nb_int*/
  0, /*nb_long*/
  0, /*nb_float*/
  0, /*nb_oct*/
  0, /*nb_hex*/
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  0, /*nb_inplace_divide*/
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
};

static PySequenceMethods __pyx_tp_as_sequence__OGGVorbisSound = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__OGGVorbisSound = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__OGGVorbisSound = {
  0, /*bf_getreadbuffer*/
  0, /*bf_getwritebuffer*/
  0, /*bf_getsegcount*/
  0, /*bf_getcharbuffer*/
};

PyTypeObject __pyx_type_6_sound__OGGVorbisSound = {
  PyObject_HEAD_INIT(0)
  0, /*ob_size*/
  "_sound._OGGVorbisSound", /*tp_name*/
  sizeof(struct __pyx_obj_6_sound__OGGVorbisSound), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6_sound__OGGVorbisSound, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_compare*/
  0, /*tp_repr*/
  &__pyx_tp_as_number__OGGVorbisSound, /*tp_as_number*/
  &__pyx_tp_as_sequence__OGGVorbisSound, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__OGGVorbisSound, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__OGGVorbisSound, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6_sound__OGGVorbisSound, /*tp_traverse*/
  __pyx_tp_clear_6_sound__OGGVorbisSound, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6_sound__OGGVorbisSound, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_f_6_sound_15_OGGVorbisSound___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6_sound__OGGVorbisSound, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
};
static struct __pyx_vtabstruct_6_sound__SoundPlayer __pyx_vtable_6_sound__SoundPlayer;

static PyObject *__pyx_tp_new_6_sound__SoundPlayer(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o = __pyx_ptype_5_soya_CoordSyst->tp_new(t, a, k);
  struct __pyx_obj_6_sound__SoundPlayer *p = (struct __pyx_obj_6_sound__SoundPlayer *)o;
  *(struct __pyx_vtabstruct_6_sound__SoundPlayer **)&p->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab = __pyx_vtabptr_6_sound__SoundPlayer;
  p->_sound = ((struct __pyx_obj_6_sound__Sound *)Py_None); Py_INCREF(Py_None);
  if (__pyx_f_6_sound_12_SoundPlayer___new__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6_sound__SoundPlayer(PyObject *o) {
  struct __pyx_obj_6_sound__SoundPlayer *p = (struct __pyx_obj_6_sound__SoundPlayer *)o;
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++o->ob_refcnt;
    __pyx_f_6_sound_12_SoundPlayer___dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    --o->ob_refcnt;
    PyErr_Restore(etype, eval, etb);
  }
  Py_XDECREF(((PyObject *)p->_sound));
  __pyx_ptype_5_soya_CoordSyst->tp_dealloc(o);
}

static int __pyx_tp_traverse_6_sound__SoundPlayer(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6_sound__SoundPlayer *p = (struct __pyx_obj_6_sound__SoundPlayer *)o;
  e = __pyx_ptype_5_soya_CoordSyst->tp_traverse(o, v, a); if (e) return e;
  if (p->_sound) {
    e = (*v)(((PyObject*)p->_sound), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6_sound__SoundPlayer(PyObject *o) {
  struct __pyx_obj_6_sound__SoundPlayer *p = (struct __pyx_obj_6_sound__SoundPlayer *)o;
  __pyx_ptype_5_soya_CoordSyst->tp_clear(o);
  Py_XDECREF(((PyObject *)p->_sound));
  p->_sound = ((struct __pyx_obj_6_sound__Sound *)Py_None); Py_INCREF(Py_None);
  return 0;
}

static PyObject *__pyx_getprop_6_sound_12_SoundPlayer_sound(PyObject *o, void *x) {
  return __pyx_f_6_sound_12_SoundPlayer_5sound___get__(o);
}

static PyObject *__pyx_getprop_6_sound_12_SoundPlayer_loop(PyObject *o, void *x) {
  return __pyx_f_6_sound_12_SoundPlayer_4loop___get__(o);
}

static int __pyx_setprop_6_sound_12_SoundPlayer_loop(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_f_6_sound_12_SoundPlayer_4loop___set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_6_sound_12_SoundPlayer_auto_remove(PyObject *o, void *x) {
  return __pyx_f_6_sound_12_SoundPlayer_11auto_remove___get__(o);
}

static int __pyx_setprop_6_sound_12_SoundPlayer_auto_remove(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_f_6_sound_12_SoundPlayer_11auto_remove___set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_6_sound_12_SoundPlayer_play_in_3D(PyObject *o, void *x) {
  return __pyx_f_6_sound_12_SoundPlayer_10play_in_3D___get__(o);
}

static int __pyx_setprop_6_sound_12_SoundPlayer_play_in_3D(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_f_6_sound_12_SoundPlayer_10play_in_3D___set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_6_sound_12_SoundPlayer_gain(PyObject *o, void *x) {
  return __pyx_f_6_sound_12_SoundPlayer_4gain___get__(o);
}

static int __pyx_setprop_6_sound_12_SoundPlayer_gain(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_f_6_sound_12_SoundPlayer_4gain___set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static struct PyMethodDef __pyx_methods_6_sound__SoundPlayer[] = {
  {"begin_round", (PyCFunction)__pyx_f_6_sound_12_SoundPlayer_begin_round, METH_VARARGS|METH_KEYWORDS, 0},
  {"advance_time", (PyCFunction)__pyx_f_6_sound_12_SoundPlayer_advance_time, METH_VARARGS|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6_sound__SoundPlayer[] = {
  {"sound", __pyx_getprop_6_sound_12_SoundPlayer_sound, 0, 0, 0},
  {"loop", __pyx_getprop_6_sound_12_SoundPlayer_loop, __pyx_setprop_6_sound_12_SoundPlayer_loop, 0, 0},
  {"auto_remove", __pyx_getprop_6_sound_12_SoundPlayer_auto_remove, __pyx_setprop_6_sound_12_SoundPlayer_auto_remove, 0, 0},
  {"play_in_3D", __pyx_getprop_6_sound_12_SoundPlayer_play_in_3D, __pyx_setprop_6_sound_12_SoundPlayer_play_in_3D, 0, 0},
  {"gain", __pyx_getprop_6_sound_12_SoundPlayer_gain, __pyx_setprop_6_sound_12_SoundPlayer_gain, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__SoundPlayer = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  0, /*nb_divide*/
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  0, /*nb_coerce*/
  0, /*nb_int*/
  0, /*nb_long*/
  0, /*nb_float*/
  0, /*nb_oct*/
  0, /*nb_hex*/
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  0, /*nb_inplace_divide*/
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
};

static PySequenceMethods __pyx_tp_as_sequence__SoundPlayer = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping__SoundPlayer = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__SoundPlayer = {
  0, /*bf_getreadbuffer*/
  0, /*bf_getwritebuffer*/
  0, /*bf_getsegcount*/
  0, /*bf_getcharbuffer*/
};

PyTypeObject __pyx_type_6_sound__SoundPlayer = {
  PyObject_HEAD_INIT(0)
  0, /*ob_size*/
  "_sound._SoundPlayer", /*tp_name*/
  sizeof(struct __pyx_obj_6_sound__SoundPlayer), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6_sound__SoundPlayer, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_compare*/
  0, /*tp_repr*/
  &__pyx_tp_as_number__SoundPlayer, /*tp_as_number*/
  &__pyx_tp_as_sequence__SoundPlayer, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__SoundPlayer, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__SoundPlayer, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6_sound__SoundPlayer, /*tp_traverse*/
  __pyx_tp_clear_6_sound__SoundPlayer, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6_sound__SoundPlayer, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_6_sound__SoundPlayer, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_f_6_sound_12_SoundPlayer___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6_sound__SoundPlayer, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
};

static struct PyMethodDef __pyx_methods[] = {
  {"check_al_error", (PyCFunction)__pyx_f_6_sound_check_al_error, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6_sound_check_al_error},
  {"init_sound", (PyCFunction)__pyx_f_6_sound_init_sound, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6_sound_init_sound},
  {0, 0, 0, 0}
};

static void __pyx_init_filenames(void); /*proto*/

PyMODINIT_FUNC init_sound(void); /*proto*/
PyMODINIT_FUNC init_sound(void) {
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  __pyx_init_filenames();
  __pyx_m = Py_InitModule4("_sound", __pyx_methods, 0, 0, PYTHON_API_VERSION);
  if (!__pyx_m) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 20; goto __pyx_L1;};
  __pyx_b = PyImport_AddModule("__builtin__");
  if (!__pyx_b) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 20; goto __pyx_L1;};
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 20; goto __pyx_L1;};
  if (__Pyx_InternStrings(__pyx_intern_tab) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 20; goto __pyx_L1;};
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 20; goto __pyx_L1;};
  __pyx_v_6_sound_EAR = ((struct __pyx_obj_5_soya_CoordSyst *)Py_None); Py_INCREF(Py_None);
  __pyx_ptype_5_soya__CObj = __Pyx_ImportType("_soya", "_CObj", sizeof(struct __pyx_obj_5_soya__CObj)); if (!__pyx_ptype_5_soya__CObj) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 20; goto __pyx_L1;}
  if (__Pyx_GetVtable(__pyx_ptype_5_soya__CObj->tp_dict, &__pyx_vtabptr_5_soya__CObj) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 20; goto __pyx_L1;}
  __pyx_ptype_5_soya__Image = __Pyx_ImportType("_soya", "_Image", sizeof(struct __pyx_obj_5_soya__Image)); if (!__pyx_ptype_5_soya__Image) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 21; goto __pyx_L1;}
  if (__Pyx_GetVtable(__pyx_ptype_5_soya__Image->tp_dict, &__pyx_vtabptr_5_soya__Image) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 21; goto __pyx_L1;}
  __pyx_ptype_5_soya__Material = __Pyx_ImportType("_soya", "_Material", sizeof(struct __pyx_obj_5_soya__Material)); if (!__pyx_ptype_5_soya__Material) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 22; goto __pyx_L1;}
  if (__Pyx_GetVtable(__pyx_ptype_5_soya__Material->tp_dict, &__pyx_vtabptr_5_soya__Material) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 22; goto __pyx_L1;}
  __pyx_ptype_5_soya__Shape = __Pyx_ImportType("_soya", "_Shape", sizeof(struct __pyx_obj_5_soya__Shape)); if (!__pyx_ptype_5_soya__Shape) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 23; goto __pyx_L1;}
  if (__Pyx_GetVtable(__pyx_ptype_5_soya__Shape->tp_dict, &__pyx_vtabptr_5_soya__Shape) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 23; goto __pyx_L1;}
  __pyx_ptype_5_soya__SimpleShape = __Pyx_ImportType("_soya", "_SimpleShape", sizeof(struct __pyx_obj_5_soya__SimpleShape)); if (!__pyx_ptype_5_soya__SimpleShape) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 24; goto __pyx_L1;}
  if (__Pyx_GetVtable(__pyx_ptype_5_soya__SimpleShape->tp_dict, &__pyx_vtabptr_5_soya__SimpleShape) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 24; goto __pyx_L1;}
  __pyx_ptype_5_soya__CellShadingShape = __Pyx_ImportType("_soya", "_CellShadingShape", sizeof(struct __pyx_obj_5_soya__CellShadingShape)); if (!__pyx_ptype_5_soya__CellShadingShape) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 25; goto __pyx_L1;}
  if (__Pyx_GetVtable(__pyx_ptype_5_soya__CellShadingShape->tp_dict, &__pyx_vtabptr_5_soya__CellShadingShape) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 25; goto __pyx_L1;}
  __pyx_ptype_5_soya__TreeShape = __Pyx_ImportType("_soya", "_TreeShape", sizeof(struct __pyx_obj_5_soya__TreeShape)); if (!__pyx_ptype_5_soya__TreeShape) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 26; goto __pyx_L1;}
  if (__Pyx_GetVtable(__pyx_ptype_5_soya__TreeShape->tp_dict, &__pyx_vtabptr_5_soya__TreeShape) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 26; goto __pyx_L1;}
  __pyx_ptype_5_soya__ModelData = __Pyx_ImportType("_soya", "_ModelData", sizeof(struct __pyx_obj_5_soya__ModelData)); if (!__pyx_ptype_5_soya__ModelData) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 27; goto __pyx_L1;}
  if (__Pyx_GetVtable(__pyx_ptype_5_soya__ModelData->tp_dict, &__pyx_vtabptr_5_soya__ModelData) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 27; goto __pyx_L1;}
  __pyx_ptype_5_soya__AnimatedModelData = __Pyx_ImportType("_soya", "_AnimatedModelData", sizeof(struct __pyx_obj_5_soya__AnimatedModelData)); if (!__pyx_ptype_5_soya__AnimatedModelData) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 28; goto __pyx_L1;}
  if (__Pyx_GetVtable(__pyx_ptype_5_soya__AnimatedModelData->tp_dict, &__pyx_vtabptr_5_soya__AnimatedModelData) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 28; goto __pyx_L1;}
  __pyx_ptype_5_soya_Position = __Pyx_ImportType("_soya", "Position", sizeof(struct __pyx_obj_5_soya_Position)); if (!__pyx_ptype_5_soya_Position) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 29; goto __pyx_L1;}
  if (__Pyx_GetVtable(__pyx_ptype_5_soya_Position->tp_dict, &__pyx_vtabptr_5_soya_Position) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 29; goto __pyx_L1;}
  __pyx_ptype_5_soya__Point = __Pyx_ImportType("_soya", "_Point", sizeof(struct __pyx_obj_5_soya__Point)); if (!__pyx_ptype_5_soya__Point) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 30; goto __pyx_L1;}
  if (__Pyx_GetVtable(__pyx_ptype_5_soya__Point->tp_dict, &__pyx_vtabptr_5_soya__Point) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 30; goto __pyx_L1;}
  __pyx_ptype_5_soya__Vector = __Pyx_ImportType("_soya", "_Vector", sizeof(struct __pyx_obj_5_soya__Vector)); if (!__pyx_ptype_5_soya__Vector) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 31; goto __pyx_L1;}
  if (__Pyx_GetVtable(__pyx_ptype_5_soya__Vector->tp_dict, &__pyx_vtabptr_5_soya__Vector) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 31; goto __pyx_L1;}
  __pyx_ptype_5_soya__Vertex = __Pyx_ImportType("_soya", "_Vertex", sizeof(struct __pyx_obj_5_soya__Vertex)); if (!__pyx_ptype_5_soya__Vertex) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 32; goto __pyx_L1;}
  if (__Pyx_GetVtable(__pyx_ptype_5_soya__Vertex->tp_dict, &__pyx_vtabptr_5_soya__Vertex) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 32; goto __pyx_L1;}
  __pyx_ptype_5_soya_CoordSyst = __Pyx_ImportType("_soya", "CoordSyst", sizeof(struct __pyx_obj_5_soya_CoordSyst)); if (!__pyx_ptype_5_soya_CoordSyst) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 33; goto __pyx_L1;}
  if (__Pyx_GetVtable(__pyx_ptype_5_soya_CoordSyst->tp_dict, &__pyx_vtabptr_5_soya_CoordSyst) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 33; goto __pyx_L1;}
  __pyx_ptype_5_soya__Camera = __Pyx_ImportType("_soya", "_Camera", sizeof(struct __pyx_obj_5_soya__Camera)); if (!__pyx_ptype_5_soya__Camera) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 34; goto __pyx_L1;}
  if (__Pyx_GetVtable(__pyx_ptype_5_soya__Camera->tp_dict, &__pyx_vtabptr_5_soya__Camera) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 34; goto __pyx_L1;}
  __pyx_ptype_5_soya__Light = __Pyx_ImportType("_soya", "_Light", sizeof(struct __pyx_obj_5_soya__Light)); if (!__pyx_ptype_5_soya__Light) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 35; goto __pyx_L1;}
  if (__Pyx_GetVtable(__pyx_ptype_5_soya__Light->tp_dict, &__pyx_vtabptr_5_soya__Light) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 35; goto __pyx_L1;}
  __pyx_ptype_5_soya__Volume = __Pyx_ImportType("_soya", "_Volume", sizeof(struct __pyx_obj_5_soya__Volume)); if (!__pyx_ptype_5_soya__Volume) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 36; goto __pyx_L1;}
  if (__Pyx_GetVtable(__pyx_ptype_5_soya__Volume->tp_dict, &__pyx_vtabptr_5_soya__Volume) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 36; goto __pyx_L1;}
  __pyx_ptype_5_soya__World = __Pyx_ImportType("_soya", "_World", sizeof(struct __pyx_obj_5_soya__World)); if (!__pyx_ptype_5_soya__World) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 37; goto __pyx_L1;}
  if (__Pyx_GetVtable(__pyx_ptype_5_soya__World->tp_dict, &__pyx_vtabptr_5_soya__World) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 37; goto __pyx_L1;}
  __pyx_ptype_5_soya__Face = __Pyx_ImportType("_soya", "_Face", sizeof(struct __pyx_obj_5_soya__Face)); if (!__pyx_ptype_5_soya__Face) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 38; goto __pyx_L1;}
  if (__Pyx_GetVtable(__pyx_ptype_5_soya__Face->tp_dict, &__pyx_vtabptr_5_soya__Face) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 38; goto __pyx_L1;}
  __pyx_ptype_5_soya__Cal3dShape = __Pyx_ImportType("_soya", "_Cal3dShape", sizeof(struct __pyx_obj_5_soya__Cal3dShape)); if (!__pyx_ptype_5_soya__Cal3dShape) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 40; goto __pyx_L1;}
  if (__Pyx_GetVtable(__pyx_ptype_5_soya__Cal3dShape->tp_dict, &__pyx_vtabptr_5_soya__Cal3dShape) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 40; goto __pyx_L1;}
  __pyx_ptype_5_soya__Sprite = __Pyx_ImportType("_soya", "_Sprite", sizeof(struct __pyx_obj_5_soya__Sprite)); if (!__pyx_ptype_5_soya__Sprite) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 41; goto __pyx_L1;}
  if (__Pyx_GetVtable(__pyx_ptype_5_soya__Sprite->tp_dict, &__pyx_vtabptr_5_soya__Sprite) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 41; goto __pyx_L1;}
  __pyx_ptype_5_soya__Portal = __Pyx_ImportType("_soya", "_Portal", sizeof(struct __pyx_obj_5_soya__Portal)); if (!__pyx_ptype_5_soya__Portal) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 42; goto __pyx_L1;}
  if (__Pyx_GetVtable(__pyx_ptype_5_soya__Portal->tp_dict, &__pyx_vtabptr_5_soya__Portal) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 42; goto __pyx_L1;}
  __pyx_ptype_5_soya__Land = __Pyx_ImportType("_soya", "_Land", sizeof(struct __pyx_obj_5_soya__Land)); if (!__pyx_ptype_5_soya__Land) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 43; goto __pyx_L1;}
  if (__Pyx_GetVtable(__pyx_ptype_5_soya__Land->tp_dict, &__pyx_vtabptr_5_soya__Land) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 43; goto __pyx_L1;}
  __pyx_ptype_5_soya__Atmosphere = __Pyx_ImportType("_soya", "_Atmosphere", sizeof(struct __pyx_obj_5_soya__Atmosphere)); if (!__pyx_ptype_5_soya__Atmosphere) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 44; goto __pyx_L1;}
  if (__Pyx_GetVtable(__pyx_ptype_5_soya__Atmosphere->tp_dict, &__pyx_vtabptr_5_soya__Atmosphere) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 44; goto __pyx_L1;}
  __pyx_ptype_5_soya_Renderer = __Pyx_ImportType("_soya", "Renderer", sizeof(struct __pyx_obj_5_soya_Renderer)); if (!__pyx_ptype_5_soya_Renderer) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 45; goto __pyx_L1;}
  if (__Pyx_GetVtable(__pyx_ptype_5_soya_Renderer->tp_dict, &__pyx_vtabptr_5_soya_Renderer) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 45; goto __pyx_L1;}
  __pyx_ptype_5_soya_Context = __Pyx_ImportType("_soya", "Context", sizeof(struct __pyx_obj_5_soya_Context)); if (!__pyx_ptype_5_soya_Context) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 46; goto __pyx_L1;}
  __pyx_ptype_5_soya_RaypickData = __Pyx_ImportType("_soya", "RaypickData", sizeof(struct __pyx_obj_5_soya_RaypickData)); if (!__pyx_ptype_5_soya_RaypickData) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; goto __pyx_L1;}
  __pyx_ptype_5_soya_RaypickContext = __Pyx_ImportType("_soya", "RaypickContext", sizeof(struct __pyx_obj_5_soya_RaypickContext)); if (!__pyx_ptype_5_soya_RaypickContext) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 48; goto __pyx_L1;}
  __pyx_ptype_5_soya_Idler = __Pyx_ImportType("_soya", "Idler", sizeof(struct __pyx_obj_5_soya_Idler)); if (!__pyx_ptype_5_soya_Idler) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 49; goto __pyx_L1;}
  __pyx_ptype_5_soya_Glyph = __Pyx_ImportType("_soya", "Glyph", sizeof(struct __pyx_obj_5_soya_Glyph)); if (!__pyx_ptype_5_soya_Glyph) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 50; goto __pyx_L1;}
  __pyx_ptype_5_soya_Font = __Pyx_ImportType("_soya", "Font", sizeof(struct __pyx_obj_5_soya_Font)); if (!__pyx_ptype_5_soya_Font) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; goto __pyx_L1;}
  if (__Pyx_GetVtable(__pyx_ptype_5_soya_Font->tp_dict, &__pyx_vtabptr_5_soya_Font) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; goto __pyx_L1;}
  __pyx_ptype_5_soya_Shapifier = __Pyx_ImportType("_soya", "Shapifier", sizeof(struct __pyx_obj_5_soya_Shapifier)); if (!__pyx_ptype_5_soya_Shapifier) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 52; goto __pyx_L1;}
  if (__Pyx_GetVtable(__pyx_ptype_5_soya_Shapifier->tp_dict, &__pyx_vtabptr_5_soya_Shapifier) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 52; goto __pyx_L1;}
  __pyx_ptype_5_soya_Traveling = __Pyx_ImportType("_soya", "Traveling", sizeof(struct __pyx_obj_5_soya_Traveling)); if (!__pyx_ptype_5_soya_Traveling) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 53; goto __pyx_L1;}
  if (__Pyx_GetVtable(__pyx_ptype_5_soya_Traveling->tp_dict, &__pyx_vtabptr_5_soya_Traveling) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 53; goto __pyx_L1;}
  __pyx_ptype_5_soya__TravelingCamera = __Pyx_ImportType("_soya", "_TravelingCamera", sizeof(struct __pyx_obj_5_soya__TravelingCamera)); if (!__pyx_ptype_5_soya__TravelingCamera) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 54; goto __pyx_L1;}
  if (__Pyx_GetVtable(__pyx_ptype_5_soya__TravelingCamera->tp_dict, &__pyx_vtabptr_5_soya__TravelingCamera) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 54; goto __pyx_L1;}
  __pyx_ptype_5_soya__NoBackgroundAtmosphere = __Pyx_ImportType("_soya", "_NoBackgroundAtmosphere", sizeof(struct __pyx_obj_5_soya__NoBackgroundAtmosphere)); if (!__pyx_ptype_5_soya__NoBackgroundAtmosphere) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 33; goto __pyx_L1;}
  if (__Pyx_GetVtable(__pyx_ptype_5_soya__NoBackgroundAtmosphere->tp_dict, &__pyx_vtabptr_5_soya__NoBackgroundAtmosphere) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 33; goto __pyx_L1;}
  __pyx_ptype_5_soya__SkyAtmosphere = __Pyx_ImportType("_soya", "_SkyAtmosphere", sizeof(struct __pyx_obj_5_soya__SkyAtmosphere)); if (!__pyx_ptype_5_soya__SkyAtmosphere) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 37; goto __pyx_L1;}
  if (__Pyx_GetVtable(__pyx_ptype_5_soya__SkyAtmosphere->tp_dict, &__pyx_vtabptr_5_soya__SkyAtmosphere) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 37; goto __pyx_L1;}
  __pyx_ptype_5_soya_PythonCoordSyst = __Pyx_ImportType("_soya", "PythonCoordSyst", sizeof(struct __pyx_obj_5_soya_PythonCoordSyst)); if (!__pyx_ptype_5_soya_PythonCoordSyst) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; goto __pyx_L1;}
  if (__Pyx_GetVtable(__pyx_ptype_5_soya_PythonCoordSyst->tp_dict, &__pyx_vtabptr_5_soya_PythonCoordSyst) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; goto __pyx_L1;}
  __pyx_ptype_5_soya_CoordSystState = __Pyx_ImportType("_soya", "CoordSystState", sizeof(struct __pyx_obj_5_soya_CoordSystState)); if (!__pyx_ptype_5_soya_CoordSystState) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 42; goto __pyx_L1;}
  if (__Pyx_GetVtable(__pyx_ptype_5_soya_CoordSystState->tp_dict, &__pyx_vtabptr_5_soya_CoordSystState) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 42; goto __pyx_L1;}
  __pyx_ptype_5_soya__FixTraveling = __Pyx_ImportType("_soya", "_FixTraveling", sizeof(struct __pyx_obj_5_soya__FixTraveling)); if (!__pyx_ptype_5_soya__FixTraveling) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 34; goto __pyx_L1;}
  if (__Pyx_GetVtable(__pyx_ptype_5_soya__FixTraveling->tp_dict, &__pyx_vtabptr_5_soya__FixTraveling) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 34; goto __pyx_L1;}
  __pyx_ptype_5_soya__ThirdPersonTraveling = __Pyx_ImportType("_soya", "_ThirdPersonTraveling", sizeof(struct __pyx_obj_5_soya__ThirdPersonTraveling)); if (!__pyx_ptype_5_soya__ThirdPersonTraveling) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 38; goto __pyx_L1;}
  if (__Pyx_GetVtable(__pyx_ptype_5_soya__ThirdPersonTraveling->tp_dict, &__pyx_vtabptr_5_soya__ThirdPersonTraveling) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 38; goto __pyx_L1;}
  __pyx_ptype_5_soya__PythonMaterial = __Pyx_ImportType("_soya", "_PythonMaterial", sizeof(struct __pyx_obj_5_soya__PythonMaterial)); if (!__pyx_ptype_5_soya__PythonMaterial) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 22; goto __pyx_L1;}
  if (__Pyx_GetVtable(__pyx_ptype_5_soya__PythonMaterial->tp_dict, &__pyx_vtabptr_5_soya__PythonMaterial) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 22; goto __pyx_L1;}
  __pyx_ptype_5_soya__CylinderSprite = __Pyx_ImportType("_soya", "_CylinderSprite", sizeof(struct __pyx_obj_5_soya__CylinderSprite)); if (!__pyx_ptype_5_soya__CylinderSprite) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 32; goto __pyx_L1;}
  if (__Pyx_GetVtable(__pyx_ptype_5_soya__CylinderSprite->tp_dict, &__pyx_vtabptr_5_soya__CylinderSprite) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 32; goto __pyx_L1;}
  __pyx_ptype_5_soya__Bonus = __Pyx_ImportType("_soya", "_Bonus", sizeof(struct __pyx_obj_5_soya__Bonus)); if (!__pyx_ptype_5_soya__Bonus) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 38; goto __pyx_L1;}
  if (__Pyx_GetVtable(__pyx_ptype_5_soya__Bonus->tp_dict, &__pyx_vtabptr_5_soya__Bonus) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 38; goto __pyx_L1;}
  __pyx_ptype_5_soya__Particles = __Pyx_ImportType("_soya", "_Particles", sizeof(struct __pyx_obj_5_soya__Particles)); if (!__pyx_ptype_5_soya__Particles) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 20; goto __pyx_L1;}
  if (__Pyx_GetVtable(__pyx_ptype_5_soya__Particles->tp_dict, &__pyx_vtabptr_5_soya__Particles) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 20; goto __pyx_L1;}
  __pyx_ptype_5_soya_FlagFirework = __Pyx_ImportType("_soya", "FlagFirework", sizeof(struct __pyx_obj_5_soya_FlagFirework)); if (!__pyx_ptype_5_soya_FlagFirework) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 52; goto __pyx_L1;}
  if (__Pyx_GetVtable(__pyx_ptype_5_soya_FlagFirework->tp_dict, &__pyx_vtabptr_5_soya_FlagFirework) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 52; goto __pyx_L1;}
  __pyx_ptype_5_soya_SimpleShapifier = __Pyx_ImportType("_soya", "SimpleShapifier", sizeof(struct __pyx_obj_5_soya_SimpleShapifier)); if (!__pyx_ptype_5_soya_SimpleShapifier) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 24; goto __pyx_L1;}
  if (__Pyx_GetVtable(__pyx_ptype_5_soya_SimpleShapifier->tp_dict, &__pyx_vtabptr_5_soya_SimpleShapifier) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 24; goto __pyx_L1;}
  __pyx_ptype_5_soya_TreeShapifier = __Pyx_ImportType("_soya", "TreeShapifier", sizeof(struct __pyx_obj_5_soya_TreeShapifier)); if (!__pyx_ptype_5_soya_TreeShapifier) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 33; goto __pyx_L1;}
  if (__Pyx_GetVtable(__pyx_ptype_5_soya_TreeShapifier->tp_dict, &__pyx_vtabptr_5_soya_TreeShapifier) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 33; goto __pyx_L1;}
  __pyx_ptype_5_soya_CellShadingShapifier = __Pyx_ImportType("_soya", "CellShadingShapifier", sizeof(struct __pyx_obj_5_soya_CellShadingShapifier)); if (!__pyx_ptype_5_soya_CellShadingShapifier) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 43; goto __pyx_L1;}
  if (__Pyx_GetVtable(__pyx_ptype_5_soya_CellShadingShapifier->tp_dict, &__pyx_vtabptr_5_soya_CellShadingShapifier) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 43; goto __pyx_L1;}
  __pyx_ptype_5_soya__Cal3dSubMesh = __Pyx_ImportType("_soya", "_Cal3dSubMesh", sizeof(struct __pyx_obj_5_soya__Cal3dSubMesh)); if (!__pyx_ptype_5_soya__Cal3dSubMesh) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 21; goto __pyx_L1;}
  if (__Pyx_GetVtable(__pyx_ptype_5_soya__Cal3dSubMesh->tp_dict, &__pyx_vtabptr_5_soya__Cal3dSubMesh) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 21; goto __pyx_L1;}
  __pyx_vtabptr_6_sound__Sound = &__pyx_vtable_6_sound__Sound;
  __pyx_vtable_6_sound__Sound.__pyx_base = *__pyx_vtabptr_5_soya__CObj;
  *(void **)&__pyx_vtable_6_sound__Sound._getbuffer = (void *)__pyx_f_6_sound_6_Sound__getbuffer;
  __pyx_type_6_sound__Sound.tp_base = __pyx_ptype_5_soya__CObj;
  __pyx_type_6_sound__Sound.tp_free = _PyObject_GC_Del;
  if (PyType_Ready(&__pyx_type_6_sound__Sound) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; goto __pyx_L1;}
  if (__Pyx_SetVtable(__pyx_type_6_sound__Sound.tp_dict, __pyx_vtabptr_6_sound__Sound) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; goto __pyx_L1;}
  if (PyObject_SetAttrString(__pyx_m, "_Sound", (PyObject *)&__pyx_type_6_sound__Sound) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; goto __pyx_L1;}
  __pyx_ptype_6_sound__Sound = &__pyx_type_6_sound__Sound;
  __pyx_vtabptr_6_sound__WAVSound = &__pyx_vtable_6_sound__WAVSound;
  __pyx_vtable_6_sound__WAVSound.__pyx_base = *__pyx_vtabptr_6_sound__Sound;
  *(void **)&__pyx_vtable_6_sound__WAVSound.__pyx_base._getbuffer = (void *)__pyx_f_6_sound_9_WAVSound__getbuffer;
  *(void **)&__pyx_vtable_6_sound__WAVSound._getnextdata = (void *)__pyx_f_6_sound_9_WAVSound__getnextdata;
  __pyx_type_6_sound__WAVSound.tp_base = __pyx_ptype_6_sound__Sound;
  if (PyType_Ready(&__pyx_type_6_sound__WAVSound) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; goto __pyx_L1;}
  if (__Pyx_SetVtable(__pyx_type_6_sound__WAVSound.tp_dict, __pyx_vtabptr_6_sound__WAVSound) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; goto __pyx_L1;}
  if (PyObject_SetAttrString(__pyx_m, "_WAVSound", (PyObject *)&__pyx_type_6_sound__WAVSound) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; goto __pyx_L1;}
  __pyx_ptype_6_sound__WAVSound = &__pyx_type_6_sound__WAVSound;
  __pyx_vtabptr_6_sound__OGGVorbisSound = &__pyx_vtable_6_sound__OGGVorbisSound;
  __pyx_vtable_6_sound__OGGVorbisSound.__pyx_base = *__pyx_vtabptr_6_sound__Sound;
  *(void **)&__pyx_vtable_6_sound__OGGVorbisSound.__pyx_base._getbuffer = (void *)__pyx_f_6_sound_15_OGGVorbisSound__getbuffer;
  *(void **)&__pyx_vtable_6_sound__OGGVorbisSound._getdata = (void *)__pyx_f_6_sound_15_OGGVorbisSound__getdata;
  __pyx_type_6_sound__OGGVorbisSound.tp_base = __pyx_ptype_6_sound__Sound;
  if (PyType_Ready(&__pyx_type_6_sound__OGGVorbisSound) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; goto __pyx_L1;}
  if (__Pyx_SetVtable(__pyx_type_6_sound__OGGVorbisSound.tp_dict, __pyx_vtabptr_6_sound__OGGVorbisSound) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; goto __pyx_L1;}
  if (PyObject_SetAttrString(__pyx_m, "_OGGVorbisSound", (PyObject *)&__pyx_type_6_sound__OGGVorbisSound) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; goto __pyx_L1;}
  __pyx_ptype_6_sound__OGGVorbisSound = &__pyx_type_6_sound__OGGVorbisSound;
  __pyx_vtabptr_6_sound__SoundPlayer = &__pyx_vtable_6_sound__SoundPlayer;
  __pyx_vtable_6_sound__SoundPlayer.__pyx_base = *__pyx_vtabptr_5_soya_CoordSyst;
  *(void **)&__pyx_vtable_6_sound__SoundPlayer.__pyx_base.__pyx_base.__pyx_base.__getcstate__ = (void *)__pyx_f_6_sound_12_SoundPlayer___getcstate__;
  *(void **)&__pyx_vtable_6_sound__SoundPlayer.__pyx_base.__pyx_base.__pyx_base.__setcstate__ = (void *)__pyx_f_6_sound_12_SoundPlayer___setcstate__;
  __pyx_type_6_sound__SoundPlayer.tp_base = __pyx_ptype_5_soya_CoordSyst;
  __pyx_type_6_sound__SoundPlayer.tp_free = _PyObject_GC_Del;
  if (PyType_Ready(&__pyx_type_6_sound__SoundPlayer) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; goto __pyx_L1;}
  if (__Pyx_SetVtable(__pyx_type_6_sound__SoundPlayer.tp_dict, __pyx_vtabptr_6_sound__SoundPlayer) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; goto __pyx_L1;}
  if (PyObject_SetAttrString(__pyx_m, "_SoundPlayer", (PyObject *)&__pyx_type_6_sound__SoundPlayer) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; goto __pyx_L1;}
  __pyx_ptype_6_sound__SoundPlayer = &__pyx_type_6_sound__SoundPlayer;

  /* "/home/jiba/src/soya/sound/sound.pyx":39 */
  __pyx_1 = PyDict_New(); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
  __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_StandardError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
  __pyx_2 = 0;
  __pyx_2 = __Pyx_CreateClass(__pyx_3, __pyx_1, __pyx_n_ALError, "_sound"); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;

  /* "/home/jiba/src/soya/sound/sound.pyx":40 */
  if (PyObject_SetAttr(__pyx_m, __pyx_n_ALError, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  Py_DECREF(__pyx_1); __pyx_1 = 0;

  /* "/home/jiba/src/soya/sound/sound.pyx":71 */
  if (!__Pyx_TypeTest(Py_None, __pyx_ptype_5_soya_CoordSyst)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; goto __pyx_L1;}
  Py_INCREF(Py_None);
  Py_DECREF(((PyObject *)__pyx_v_6_sound_EAR));
  __pyx_v_6_sound_EAR = ((struct __pyx_obj_5_soya_CoordSyst *)Py_None);

  /* "/home/jiba/src/soya/sound/sound.pyx":74 */
  __pyx_v_6_sound__SOUND_INITED = 0;

  /* "/home/jiba/src/soya/sound/sound.pyx":77 */
  __pyx_v_6_sound__device = 0;

  /* "/home/jiba/src/soya/sound/sound.pyx":80 */
  __pyx_v_6_sound__context = 0;

  /* "/home/jiba/src/soya/sound/sound.pyx":83 */
  Py_INCREF(__pyx_k2p);
  __pyx_k3 = __pyx_k2p;
  __pyx_3 = PyInt_FromLong(44100); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; goto __pyx_L1;}
  __pyx_k4 = __pyx_3;
  __pyx_3 = 0;
  __pyx_1 = PyFloat_FromDouble(0.01); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; goto __pyx_L1;}
  __pyx_k5 = __pyx_1;
  __pyx_1 = 0;

  /* "/home/jiba/src/soya/sound/sound.pyx":280 */
  if (!__Pyx_TypeTest(Py_None, __pyx_ptype_5_soya__World)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; goto __pyx_L1;}
  Py_INCREF(Py_None);
  __pyx_k6 = ((struct __pyx_obj_5_soya__World *)Py_None);
  if (!__Pyx_TypeTest(Py_None, __pyx_ptype_6_sound__Sound)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; goto __pyx_L1;}
  Py_INCREF(Py_None);
  __pyx_k7 = ((struct __pyx_obj_6_sound__Sound *)Py_None);
  __pyx_k8 = 0;
  __pyx_k9 = 1;
  __pyx_k10 = 1.0;
  __pyx_k11 = 1;

  /* "/home/jiba/src/soya/sound/sound.pyx":430 */
  return;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  __Pyx_AddTraceback("_sound");
}

static char *__pyx_filenames[] = {
  "sound.pyx",
  "_sound.pyx",
  "base.pxd",
  "atmosphere.pxd",
  "coordsyst.pxd",
  "traveling_camera.pxd",
  "material.pxd",
  "sprite.pxd",
  "particle.pxd",
  "shapifier.pxd",
  "shape.pxd",
};

/* Runtime support code */

static void __pyx_init_filenames(void) {
  __pyx_f = __pyx_filenames;
}

static int __Pyx_GetStarArgs(
    PyObject **args, 
    PyObject **kwds,
    char *kwd_list[], 
    int nargs,
    PyObject **args2, 
    PyObject **kwds2)
{
    PyObject *x = 0, *args1 = 0, *kwds1 = 0;
    
    if (args2)
        *args2 = 0;
    if (kwds2)
        *kwds2 = 0;
    
    if (args2) {
        args1 = PyTuple_GetSlice(*args, 0, nargs);
        if (!args1)
            goto bad;
        *args2 = PyTuple_GetSlice(*args, nargs, PyTuple_Size(*args));
        if (!*args2)
            goto bad;
    }
    else {
        args1 = *args;
        Py_INCREF(args1);
    }
    
    if (kwds2) {
        if (*kwds) {
            char **p;
            kwds1 = PyDict_New();
            if (!kwds)
                goto bad;
            *kwds2 = PyDict_Copy(*kwds);
            if (!*kwds2)
                goto bad;
            for (p = kwd_list; *p; p++) {
                x = PyDict_GetItemString(*kwds, *p);
                if (x) {
                    if (PyDict_SetItemString(kwds1, *p, x) < 0)
                        goto bad;
                    if (PyDict_DelItemString(*kwds2, *p) < 0)
                        goto bad;
                }
            }
        }
        else {
            *kwds2 = PyDict_New();
            if (!*kwds2)
                goto bad;
        }
    }
    else {
        kwds1 = *kwds;
        Py_XINCREF(kwds1);
    }
    
    *args = args1;
    *kwds = kwds1;
    return 0;
bad:
    Py_XDECREF(args1);
    Py_XDECREF(kwds1);
    if (*args2)
        Py_XDECREF(*args2);
    if (*kwds2)
        Py_XDECREF(*kwds2);
    return -1;
}

static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, char *name) {
    if (!type) {
        PyErr_Format(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if ((none_allowed && obj == Py_None) || PyObject_TypeCheck(obj, type))
        return 1;
    PyErr_Format(PyExc_TypeError,
        "Argument '%s' has incorrect type (expected %s, got %s)",
        name, type->tp_name, obj->ob_type->tp_name);
    return 0;
}

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
    PyObject *result;
    result = PyObject_GetAttr(dict, name);
    if (!result)
        PyErr_SetObject(PyExc_NameError, name);
    return result;
}

static PyObject *__Pyx_CreateClass(
    PyObject *bases, PyObject *dict, PyObject *name, char *modname)
{
    PyObject *py_modname;
    PyObject *result = 0;
    
    py_modname = PyString_FromString(modname);
    if (!py_modname)
        goto bad;
    if (PyDict_SetItemString(dict, "__module__", py_modname) < 0)
        goto bad;
    result = PyClass_New(bases, dict, name);
bad:
    Py_XDECREF(py_modname);
    return result;
}

static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (!type) {
        PyErr_Format(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (obj == Py_None || PyObject_TypeCheck(obj, type))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %s to %s",
        obj->ob_type->tp_name, type->tp_name);
    return 0;
}

static void __Pyx_WriteUnraisable(char *name) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    PyErr_Fetch(&old_exc, &old_val, &old_tb);
    ctx = PyString_FromString(name);
    PyErr_Restore(old_exc, old_val, old_tb);
    if (!ctx)
        ctx = Py_None;
    PyErr_WriteUnraisable(ctx);
}

static PyObject *__Pyx_GetStdout(void) {
    PyObject *f = PySys_GetObject("stdout");
    if (!f) {
        PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout");
    }
    return f;
}

static int __Pyx_PrintItem(PyObject *v) {
    PyObject *f;
    
    if (!(f = __Pyx_GetStdout()))
        return -1;
    if (PyFile_SoftSpace(f, 1)) {
        if (PyFile_WriteString(" ", f) < 0)
            return -1;
    }
    if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0)
        return -1;
    if (PyString_Check(v)) {
        char *s = PyString_AsString(v);
        int len = PyString_Size(v);
        if (len > 0 &&
            isspace(Py_CHARMASK(s[len-1])) &&
            s[len-1] != ' ')
                PyFile_SoftSpace(f, 0);
    }
    return 0;
}

static int __Pyx_PrintNewline(void) {
    PyObject *f;
    
    if (!(f = __Pyx_GetStdout()))
        return -1;
    if (PyFile_WriteString("\n", f) < 0)
        return -1;
    PyFile_SoftSpace(f, 0);
    return 0;
}

static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
    Py_XINCREF(type);
    Py_XINCREF(value);
    Py_XINCREF(tb);
    /* First, check the traceback argument, replacing None with NULL. */
    if (tb == Py_None) {
        Py_DECREF(tb);
        tb = 0;
    }
    else if (tb != NULL && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto raise_error;
    }
    /* Next, replace a missing value with None */
    if (value == NULL) {
        value = Py_None;
        Py_INCREF(value);
    }
    /* Next, repeatedly, replace a tuple exception with its first item */
    while (PyTuple_Check(type) && PyTuple_Size(type) > 0) {
        PyObject *tmp = type;
        type = PyTuple_GET_ITEM(type, 0);
        Py_INCREF(type);
        Py_DECREF(tmp);
    }
    if (PyString_Check(type))
        ;
    else if (PyClass_Check(type))
        ; /*PyErr_NormalizeException(&type, &value, &tb);*/
    else if (PyInstance_Check(type)) {
        /* Raising an instance.  The value should be a dummy. */
        if (value != Py_None) {
            PyErr_SetString(PyExc_TypeError,
              "instance exception may not have a separate value");
            goto raise_error;
        }
        else {
            /* Normalize to raise <class>, <instance> */
            Py_DECREF(value);
            value = type;
            type = (PyObject*) ((PyInstanceObject*)type)->in_class;
            Py_INCREF(type);
        }
    }
    else {
        /* Not something you can raise.  You get an exception
           anyway, just not what you specified :-) */
        PyErr_Format(PyExc_TypeError,
                 "exceptions must be strings, classes, or "
                 "instances, not %s", type->ob_type->tp_name);
        goto raise_error;
    }
    PyErr_Restore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) {
    PyObject *__import__ = 0;
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    __import__ = PyObject_GetAttrString(__pyx_b, "__import__");
    if (!__import__)
        goto bad;
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    module = PyObject_CallFunction(__import__, "OOOO",
        name, global_dict, empty_dict, list);
bad:
    Py_XDECREF(empty_list);
    Py_XDECREF(__import__);
    Py_XDECREF(empty_dict);
    return module;
}

static PyObject *__Pyx_GetExcValue(void) {
    PyObject *type = 0, *value = 0, *tb = 0;
    PyObject *result = 0;
    PyThreadState *tstate = PyThreadState_Get();
    PyErr_Fetch(&type, &value, &tb);
    PyErr_NormalizeException(&type, &value, &tb);
    if (PyErr_Occurred())
        goto bad;
    if (!value) {
        value = Py_None;
        Py_INCREF(value);
    }
    Py_XDECREF(tstate->exc_type);
    Py_XDECREF(tstate->exc_value);
    Py_XDECREF(tstate->exc_traceback);
    tstate->exc_type = type;
    tstate->exc_value = value;
    tstate->exc_traceback = tb;
    result = value;
    Py_XINCREF(result);
    type = 0;
    value = 0;
    tb = 0;
bad:
    Py_XDECREF(type);
    Py_XDECREF(value);
    Py_XDECREF(tb);
    return result;
}

static void __Pyx_UnpackError(void) {
    PyErr_SetString(PyExc_ValueError, "unpack sequence of wrong size");
}

static PyObject *__Pyx_UnpackItem(PyObject *seq, int i) {
  PyObject *item;
  if (!(item = PySequence_GetItem(seq, i))) {
    if (PyErr_ExceptionMatches(PyExc_IndexError))
    	__Pyx_UnpackError();
  }
  return item;
}

static int __Pyx_EndUnpack(PyObject *seq, int i) {
  PyObject *item;
  if (item = PySequence_GetItem(seq, i)) {
    Py_DECREF(item);
    __Pyx_UnpackError();
    return -1;
  }
  PyErr_Clear();
    return 0;
}

static int __Pyx_InternStrings(__Pyx_InternTabEntry *t) {
    while (t->p) {
        *t->p = PyString_InternFromString(t->s);
        if (!*t->p)
            return -1;
        ++t;
    }
    return 0;
}

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        if (!*t->p)
            return -1;
        ++t;
    }
    return 0;
}

static PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name, 
    long size) 
{
    PyObject *py_module_name = 0;
    PyObject *py_class_name = 0;
    PyObject *py_name_list = 0;
    PyObject *py_module = 0;
    PyObject *result = 0;
    
    py_module_name = PyString_FromString(module_name);
    if (!py_module_name)
        goto bad;
    py_class_name = PyString_FromString(class_name);
    if (!py_class_name)
        goto bad;
    py_name_list = PyList_New(1);
    if (!py_name_list)
        goto bad;
    Py_INCREF(py_class_name);
    if (PyList_SetItem(py_name_list, 0, py_class_name) < 0)
        goto bad;
    py_module = __Pyx_Import(py_module_name, py_name_list);
    if (!py_module)
        goto bad;
    result = PyObject_GetAttr(py_module, py_class_name);
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError, 
            "%s.%s is not a type object",
            module_name, class_name);
        goto bad;
    }
    if (((PyTypeObject *)result)->tp_basicsize != size) {
        PyErr_Format(PyExc_ValueError, 
            "%s.%s does not appear to be the correct type object",
            module_name, class_name);
        goto bad;
    }
    goto done;
bad:
    Py_XDECREF(result);
    result = 0;
done:
    Py_XDECREF(py_module_name);
    Py_XDECREF(py_class_name);
    Py_XDECREF(py_name_list);
    return (PyTypeObject *)result;
}

static int __Pyx_GetVtable(PyObject *dict, void *vtabptr) {
    int result;
    PyObject *pycobj;
    
    pycobj = PyMapping_GetItemString(dict, "__pyx_vtable__");
    if (!pycobj)
        goto bad;
    *(void **)vtabptr = PyCObject_AsVoidPtr(pycobj);
    if (!*(void **)vtabptr)
        goto bad;
    result = 0;
    goto done;

bad:
    result = -1;
done:
    Py_XDECREF(pycobj);
    return result;
}

static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
    PyObject *pycobj = 0;
    int result;
    
    pycobj = PyCObject_FromVoidPtr(vtable, 0);
    if (!pycobj)
        goto bad;
    if (PyDict_SetItemString(dict, "__pyx_vtable__", pycobj) < 0)
        goto bad;
    result = 0;
    goto done;

bad:
    result = -1;
done:
    Py_XDECREF(pycobj);
    return result;
}

#include "compile.h"
#include "frameobject.h"
#include "traceback.h"

static void __Pyx_AddTraceback(char *funcname) {
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    PyObject *py_globals = 0;
    PyObject *empty_tuple = 0;
    PyObject *empty_string = 0;
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;
    
    py_srcfile = PyString_FromString(__pyx_filename);
    if (!py_srcfile) goto bad;
    py_funcname = PyString_FromString(funcname);
    if (!py_funcname) goto bad;
    py_globals = PyModule_GetDict(__pyx_m);
    if (!py_globals) goto bad;
    empty_tuple = PyTuple_New(0);
    if (!empty_tuple) goto bad;
    empty_string = PyString_FromString("");
    if (!empty_string) goto bad;
    py_code = PyCode_New(
        0,            /*int argcount,*/
        0,            /*int nlocals,*/
        0,            /*int stacksize,*/
        0,            /*int flags,*/
        empty_string, /*PyObject *code,*/
        empty_tuple,  /*PyObject *consts,*/
        empty_tuple,  /*PyObject *names,*/
        empty_tuple,  /*PyObject *varnames,*/
        empty_tuple,  /*PyObject *freevars,*/
        empty_tuple,  /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        __pyx_lineno,   /*int firstlineno,*/
        empty_string  /*PyObject *lnotab*/
    );
    if (!py_code) goto bad;
    py_frame = PyFrame_New(
        PyThreadState_Get(), /*PyThreadState *tstate,*/
        py_code,             /*PyCodeObject *code,*/
        py_globals,          /*PyObject *globals,*/
        0                    /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    py_frame->f_lineno = __pyx_lineno;
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    Py_XDECREF(empty_tuple);
    Py_XDECREF(empty_string);
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}
