Commits

Anonymous committed 14d4236

new gl attributes

  • Participants
  • Parent commits 3ab3543

Comments (0)

Files changed (34)

 mixer_music src/music.c $(SDL) $(MIXER)
 movie src/movie.c $(SDL) $(SMPEG)
 surfarray src/surfarray.c $(SDL) $(NUMERIC)
+sndarray src/sndarray.c $(SDL) $(NUMERIC)
 
 
 
 # BREAK = change breaks existing code
 # BUG	= fixed a bug that was (or could have been) crashing
 
+April 25, 2002
+	added gl_set_attribute(), gl_get_attribute()
+
 April 16, 2002
         mixer keeps a reference to playing Sound objects
         channel.set_volume() can take 2 volumes for panning
 <a href=ref/pygame_mixer_music.html>mixer_music</a> ||<br>
 || <a href=ref/pygame_mouse.html>mouse</a> || 
 <a href=ref/pygame_movie.html>movie</a> || 
+<a href=ref/pygame_sndarray.html>sndarray</a> || 
 <a href=ref/pygame_surfarray.html>surfarray</a> || 
 <a href=ref/pygame_time.html>time</a> || 
 <a href=ref/pygame_transform.html>transform</a> ||<br>
 <a href=ref/pygame_display.html#get_driver>pygame.display.get_driver</a> - get the current sdl video driver<br>
 <a href=ref/pygame_display.html#get_init>pygame.display.get_init</a> - get status of display module initialization<br>
 <a href=ref/pygame_display.html#get_surface>pygame.display.get_surface</a> - get current display surface<br>
+<a href=ref/pygame_display.html#gl_get_attribute>pygame.display.gl_get_attribute</a> - get special OPENGL attributes<br>
+<a href=ref/pygame_display.html#gl_set_attribute>pygame.display.gl_set_attribute</a> - set special OPENGL attributes<br>
 <a href=ref/pygame_display.html#iconify>pygame.display.iconify</a> - minimize the display window<br>
 <a href=ref/pygame_display.html#init>pygame.display.init</a> - initialize the display module<br>
 <a href=ref/pygame_display.html#list_modes>pygame.display.list_modes</a> - query all resolutions for requested mode<br>
 <a href=ref/pygame_mouse.html#set_pos>pygame.mouse.set_pos</a> - moves the cursor position<br>
 <a href=ref/pygame_mouse.html#set_visible>pygame.mouse.set_visible</a> - show or hide the mouse cursor<br>
 <a href=ref/pygame_movie.html#Movie>pygame.movie.Movie</a> - load a new MPEG stream<br>
+<a href=ref/pygame_sndarray.html#array>pygame.sndarray.array</a> - get an array copied from a sound<br>
+<a href=ref/pygame_sndarray.html#samples>pygame.sndarray.samples</a> - get a reference to the sound samples<br>
 <a href=ref/pygame_sprite.html#Group.__len__>pygame.sprite.Group.__len__</a> -            number of sprites in group<br>
 <a href=ref/pygame_sprite.html#Group.__nonzero__>pygame.sprite.Group.__nonzero__</a> -            ask if group is empty<br>
 <a href=ref/pygame_sprite.html#Group.add>pygame.sprite.Group.add</a> -            add sprite to group<br>
 <a href=pygame_mixer_music.html>mixer_music</a> ||<br>
 || <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_movie.html>movie</a> || 
+<a href=pygame_sndarray.html>sndarray</a> || 
 <a href=pygame_surfarray.html>surfarray</a> || 
 <a href=pygame_time.html>time</a> || 
 <a href=pygame_transform.html>transform</a> ||<br>

docs/ref/Channel.html

 <a href=pygame_mixer_music.html>mixer_music</a> ||<br>
 || <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_movie.html>movie</a> || 
+<a href=pygame_sndarray.html>sndarray</a> || 
 <a href=pygame_surfarray.html>surfarray</a> || 
 <a href=pygame_time.html>time</a> || 
 <a href=pygame_transform.html>transform</a> ||<br>

docs/ref/Clock.html

 <a href=pygame_mixer_music.html>mixer_music</a> ||<br>
 || <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_movie.html>movie</a> || 
+<a href=pygame_sndarray.html>sndarray</a> || 
 <a href=pygame_surfarray.html>surfarray</a> || 
 <a href=pygame_time.html>time</a> || 
 <a href=pygame_transform.html>transform</a> ||<br>

docs/ref/Font.html

 <a href=pygame_mixer_music.html>mixer_music</a> ||<br>
 || <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_movie.html>movie</a> || 
+<a href=pygame_sndarray.html>sndarray</a> || 
 <a href=pygame_surfarray.html>surfarray</a> || 
 <a href=pygame_time.html>time</a> || 
 <a href=pygame_transform.html>transform</a> ||<br>

docs/ref/Joystick.html

 <a href=pygame_mixer_music.html>mixer_music</a> ||<br>
 || <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_movie.html>movie</a> || 
+<a href=pygame_sndarray.html>sndarray</a> || 
 <a href=pygame_surfarray.html>surfarray</a> || 
 <a href=pygame_time.html>time</a> || 
 <a href=pygame_transform.html>transform</a> ||<br>

docs/ref/Movie.html

 <a href=pygame_mixer_music.html>mixer_music</a> ||<br>
 || <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_movie.html>movie</a> || 
+<a href=pygame_sndarray.html>sndarray</a> || 
 <a href=pygame_surfarray.html>surfarray</a> || 
 <a href=pygame_time.html>time</a> || 
 <a href=pygame_transform.html>transform</a> ||<br>

docs/ref/Rect.html

 <a href=pygame_mixer_music.html>mixer_music</a> ||<br>
 || <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_movie.html>movie</a> || 
+<a href=pygame_sndarray.html>sndarray</a> || 
 <a href=pygame_surfarray.html>surfarray</a> || 
 <a href=pygame_time.html>time</a> || 
 <a href=pygame_transform.html>transform</a> ||<br>

docs/ref/Sound.html

 <a href=pygame_mixer_music.html>mixer_music</a> ||<br>
 || <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_movie.html>movie</a> || 
+<a href=pygame_sndarray.html>sndarray</a> || 
 <a href=pygame_surfarray.html>surfarray</a> || 
 <a href=pygame_time.html>time</a> || 
 <a href=pygame_transform.html>transform</a> ||<br>

docs/ref/Surface.html

 <a href=pygame_mixer_music.html>mixer_music</a> ||<br>
 || <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_movie.html>movie</a> || 
+<a href=pygame_sndarray.html>sndarray</a> || 
 <a href=pygame_surfarray.html>surfarray</a> || 
 <a href=pygame_time.html>time</a> || 
 <a href=pygame_transform.html>transform</a> ||<br>

docs/ref/pygame.html

 <a href=pygame_mixer_music.html>mixer_music</a> ||<br>
 || <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_movie.html>movie</a> || 
+<a href=pygame_sndarray.html>sndarray</a> || 
 <a href=pygame_surfarray.html>surfarray</a> || 
 <a href=pygame_time.html>time</a> || 
 <a href=pygame_transform.html>transform</a> ||<br>

docs/ref/pygame_cdrom.html

 <a href=pygame_mixer_music.html>mixer_music</a> ||<br>
 || <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_movie.html>movie</a> || 
+<a href=pygame_sndarray.html>sndarray</a> || 
 <a href=pygame_surfarray.html>surfarray</a> || 
 <a href=pygame_time.html>time</a> || 
 <a href=pygame_transform.html>transform</a> ||<br>

docs/ref/pygame_constants.html

 <a href=pygame_mixer_music.html>mixer_music</a> ||<br>
 || <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_movie.html>movie</a> || 
+<a href=pygame_sndarray.html>sndarray</a> || 
 <a href=pygame_surfarray.html>surfarray</a> || 
 <a href=pygame_time.html>time</a> || 
 <a href=pygame_transform.html>transform</a> ||<br>

docs/ref/pygame_cursors.html

 <a href=pygame_mixer_music.html>mixer_music</a> ||<br>
 || <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_movie.html>movie</a> || 
+<a href=pygame_sndarray.html>sndarray</a> || 
 <a href=pygame_surfarray.html>surfarray</a> || 
 <a href=pygame_time.html>time</a> || 
 <a href=pygame_transform.html>transform</a> ||<br>

docs/ref/pygame_display.html

 <a href=pygame_mixer_music.html>mixer_music</a> ||<br>
 || <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_movie.html>movie</a> || 
+<a href=pygame_sndarray.html>sndarray</a> || 
 <a href=pygame_surfarray.html>surfarray</a> || 
 <a href=pygame_time.html>time</a> || 
 <a href=pygame_transform.html>transform</a> ||<br>
 get current display surface</td></tr>
 
 
+<tr><td><a href=#gl_get_attribute>gl_get_attribute</a></td><td> -
+get special OPENGL attributes</td></tr>
+
+
+<tr><td><a href=#gl_set_attribute>gl_set_attribute</a></td><td> -
+set special OPENGL attributes</td></tr>
+
+
 <tr><td><a href=#iconify>iconify</a></td><td> -
 minimize the display window</td></tr>
 
 return None if called before the display mode is set.
 </ul><br>&nbsp;<br>
 
+<a name=gl_get_attribute><font size=+2><b>gl_get_attribute
+</b></font><br><font size=+1><tt>
+pygame.display.gl_get_attribute(flag) -> value
+</tt></font><ul>
+After calling <a href=#set_mode>pygame.display.set_mode()</a> with the OPENGL flag
+you will likely want to check the value of any special opengl
+attributes you requested. You will not always get what you
+requested.
+<br>&nbsp;<br>
+See <a href=#gl_set_attribute>pygame.display.gl_set_attribute()</a> for a list of flags.
+<br>&nbsp;<br>
+The OPENGL flags are; GL_ALPHA_SIZE, GL_DEPTH_SIZE, GL_STENCIL_SIZE,
+GL_ACCUM_RED_SIZE, GL_ACCUM_GREEN_SIZE, GL_ACCUM_BLUE_SIZE, GL_ACCUM_ALPHA_SIZE,
+GL_RED_SIZE, GL_GREEN_SIZE, GL_BLUE_SIZE, GL_DEPTH_SIZE
+</ul><br>&nbsp;<br>
+
+<a name=gl_set_attribute><font size=+2><b>gl_set_attribute
+</b></font><br><font size=+1><tt>
+pygame.display.gl_set_attribute(flag, value) -> None
+</tt></font><ul>
+When calling <a href=#set_mode>pygame.display.set_mode()</a> with the OPENGL flag,
+pygame automatically handles setting the opengl attributes like
+color and doublebuffering. OPENGL offers several other attributes
+you may want control over. Pass one of these attributes as the
+flag, and its appropriate value.
+<br>&nbsp;<br>
+This must be called before <a href=#set_mode>pygame.display.set_mode()</a>
+<br>&nbsp;<br>
+The OPENGL flags are; GL_ALPHA_SIZE, GL_DEPTH_SIZE, GL_STENCIL_SIZE,
+GL_ACCUM_RED_SIZE, GL_ACCUM_GREEN_SIZE, GL_ACCUM_BLUE_SIZE, GL_ACCUM_ALPHA_SIZE
+</ul><br>&nbsp;<br>
+
 <a name=iconify><font size=+2><b>iconify
 </b></font><br><font size=+1><tt>
 pygame.display.iconify() -> bool

docs/ref/pygame_draw.html

 <a href=pygame_mixer_music.html>mixer_music</a> ||<br>
 || <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_movie.html>movie</a> || 
+<a href=pygame_sndarray.html>sndarray</a> || 
 <a href=pygame_surfarray.html>surfarray</a> || 
 <a href=pygame_time.html>time</a> || 
 <a href=pygame_transform.html>transform</a> ||<br>

docs/ref/pygame_event.html

 <a href=pygame_mixer_music.html>mixer_music</a> ||<br>
 || <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_movie.html>movie</a> || 
+<a href=pygame_sndarray.html>sndarray</a> || 
 <a href=pygame_surfarray.html>surfarray</a> || 
 <a href=pygame_time.html>time</a> || 
 <a href=pygame_transform.html>transform</a> ||<br>

docs/ref/pygame_font.html

 <a href=pygame_mixer_music.html>mixer_music</a> ||<br>
 || <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_movie.html>movie</a> || 
+<a href=pygame_sndarray.html>sndarray</a> || 
 <a href=pygame_surfarray.html>surfarray</a> || 
 <a href=pygame_time.html>time</a> || 
 <a href=pygame_transform.html>transform</a> ||<br>

docs/ref/pygame_image.html

 <a href=pygame_mixer_music.html>mixer_music</a> ||<br>
 || <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_movie.html>movie</a> || 
+<a href=pygame_sndarray.html>sndarray</a> || 
 <a href=pygame_surfarray.html>surfarray</a> || 
 <a href=pygame_time.html>time</a> || 
 <a href=pygame_transform.html>transform</a> ||<br>

docs/ref/pygame_joystick.html

 <a href=pygame_mixer_music.html>mixer_music</a> ||<br>
 || <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_movie.html>movie</a> || 
+<a href=pygame_sndarray.html>sndarray</a> || 
 <a href=pygame_surfarray.html>surfarray</a> || 
 <a href=pygame_time.html>time</a> || 
 <a href=pygame_transform.html>transform</a> ||<br>

docs/ref/pygame_key.html

 <a href=pygame_mixer_music.html>mixer_music</a> ||<br>
 || <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_movie.html>movie</a> || 
+<a href=pygame_sndarray.html>sndarray</a> || 
 <a href=pygame_surfarray.html>surfarray</a> || 
 <a href=pygame_time.html>time</a> || 
 <a href=pygame_transform.html>transform</a> ||<br>

docs/ref/pygame_mixer.html

 <a href=pygame_mixer_music.html>mixer_music</a> ||<br>
 || <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_movie.html>movie</a> || 
+<a href=pygame_sndarray.html>sndarray</a> || 
 <a href=pygame_surfarray.html>surfarray</a> || 
 <a href=pygame_time.html>time</a> || 
 <a href=pygame_transform.html>transform</a> ||<br>

docs/ref/pygame_mixer_music.html

 <a href=pygame_mixer_music.html>mixer_music</a> ||<br>
 || <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_movie.html>movie</a> || 
+<a href=pygame_sndarray.html>sndarray</a> || 
 <a href=pygame_surfarray.html>surfarray</a> || 
 <a href=pygame_time.html>time</a> || 
 <a href=pygame_transform.html>transform</a> ||<br>

docs/ref/pygame_mouse.html

 <a href=pygame_mixer_music.html>mixer_music</a> ||<br>
 || <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_movie.html>movie</a> || 
+<a href=pygame_sndarray.html>sndarray</a> || 
 <a href=pygame_surfarray.html>surfarray</a> || 
 <a href=pygame_time.html>time</a> || 
 <a href=pygame_transform.html>transform</a> ||<br>

docs/ref/pygame_movie.html

 <a href=pygame_mixer_music.html>mixer_music</a> ||<br>
 || <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_movie.html>movie</a> || 
+<a href=pygame_sndarray.html>sndarray</a> || 
 <a href=pygame_surfarray.html>surfarray</a> || 
 <a href=pygame_time.html>time</a> || 
 <a href=pygame_transform.html>transform</a> ||<br>

docs/ref/pygame_sprite.html

 <a href=pygame_mixer_music.html>mixer_music</a> ||<br>
 || <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_movie.html>movie</a> || 
+<a href=pygame_sndarray.html>sndarray</a> || 
 <a href=pygame_surfarray.html>surfarray</a> || 
 <a href=pygame_time.html>time</a> || 
 <a href=pygame_transform.html>transform</a> ||<br>

docs/ref/pygame_surfarray.html

 <a href=pygame_mixer_music.html>mixer_music</a> ||<br>
 || <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_movie.html>movie</a> || 
+<a href=pygame_sndarray.html>sndarray</a> || 
 <a href=pygame_surfarray.html>surfarray</a> || 
 <a href=pygame_time.html>time</a> || 
 <a href=pygame_transform.html>transform</a> ||<br>

docs/ref/pygame_time.html

 <a href=pygame_mixer_music.html>mixer_music</a> ||<br>
 || <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_movie.html>movie</a> || 
+<a href=pygame_sndarray.html>sndarray</a> || 
 <a href=pygame_surfarray.html>surfarray</a> || 
 <a href=pygame_time.html>time</a> || 
 <a href=pygame_transform.html>transform</a> ||<br>

docs/ref/pygame_transform.html

 <a href=pygame_mixer_music.html>mixer_music</a> ||<br>
 || <a href=pygame_mouse.html>mouse</a> || 
 <a href=pygame_movie.html>movie</a> || 
+<a href=pygame_sndarray.html>sndarray</a> || 
 <a href=pygame_surfarray.html>surfarray</a> || 
 <a href=pygame_time.html>time</a> || 
 <a href=pygame_transform.html>transform</a> ||<br>
 try: import pygame.surfarray
 except (ImportError,IOError):surfarray=None
 
+try: import pygame.sndarray
+except (ImportError,IOError):sndarray=None
+
 #there's also a couple "internal" modules not needed
 #by users, but putting them here helps "dependency finder"
 #programs get everything they need (like py2exe)
 	return DisplaySurfaceObject;
 }
 
+    /*DOC*/ static char doc_gl_set_attribute[] =
+    /*DOC*/    "pygame.display.gl_set_attribute(flag, value) -> None\n"
+    /*DOC*/    "set special OPENGL attributes\n"
+    /*DOC*/    "\n"
+    /*DOC*/    "When calling pygame.display.set_mode() with the OPENGL flag,\n"
+    /*DOC*/    "pygame automatically handles setting the opengl attributes like\n"
+    /*DOC*/    "color and doublebuffering. OPENGL offers several other attributes\n"
+    /*DOC*/    "you may want control over. Pass one of these attributes as the\n"
+    /*DOC*/    "flag, and its appropriate value.\n"
+    /*DOC*/    "\n"
+    /*DOC*/    "This must be called before pygame.display.set_mode()\n"
+    /*DOC*/    "\n"
+    /*DOC*/    "The OPENGL flags are; GL_ALPHA_SIZE, GL_DEPTH_SIZE, GL_STENCIL_SIZE,\n"
+    /*DOC*/    "GL_ACCUM_RED_SIZE, GL_ACCUM_GREEN_SIZE, GL_ACCUM_BLUE_SIZE, GL_ACCUM_ALPHA_SIZE\n"
+    /*DOC*/ ;
 
+static PyObject* gl_set_attribute(PyObject* self, PyObject* arg)
+{
+        int flag, value, result;
+    
+	VIDEO_INIT_CHECK();
+
+    	if(!PyArg_ParseTuple(arg, "ii", &flag, &value))
+
+		return NULL;
+	result = SDL_GL_SetAttribute(flag, value);
+        if(result == -1)
+            return RAISE(PyExc_SDLError, SDL_GetError());
+        
+        RETURN_NONE
+}
+
+
+    /*DOC*/ static char doc_gl_get_attribute[] =
+    /*DOC*/    "pygame.display.gl_get_attribute(flag) -> value\n"
+    /*DOC*/    "get special OPENGL attributes\n"
+    /*DOC*/    "\n"
+    /*DOC*/    "After calling pygame.display.set_mode() with the OPENGL flag\n"
+    /*DOC*/    "you will likely want to check the value of any special opengl\n"
+    /*DOC*/    "attributes you requested. You will not always get what you\n"
+    /*DOC*/    "requested.\n"
+    /*DOC*/    "\n"
+    /*DOC*/    "See pygame.display.gl_set_attribute() for a list of flags.\n"
+    /*DOC*/    "\n"
+    /*DOC*/    "The OPENGL flags are; GL_ALPHA_SIZE, GL_DEPTH_SIZE, GL_STENCIL_SIZE,\n"
+    /*DOC*/    "GL_ACCUM_RED_SIZE, GL_ACCUM_GREEN_SIZE, GL_ACCUM_BLUE_SIZE, GL_ACCUM_ALPHA_SIZE,\n"
+    /*DOC*/    "GL_RED_SIZE, GL_GREEN_SIZE, GL_BLUE_SIZE, GL_DEPTH_SIZE\n"
+    /*DOC*/ ;
+
+static PyObject* gl_get_attribute(PyObject* self, PyObject* arg)
+{
+        int flag, value, result;
+    
+	VIDEO_INIT_CHECK();
+
+	if(!PyArg_ParseTuple(arg, "i", &flag))
+		return NULL;
+
+	result = SDL_GL_GetAttribute(flag, &value);
+        if(result == -1)
+            return RAISE(PyExc_SDLError, SDL_GetError());
+        
+        return PyInt_FromLong(value);
+}
+
+
+            
     /*DOC*/ static char doc_set_mode[] =
     /*DOC*/    "pygame.display.set_mode(size, [flags, [depth]]) -> Surface\n"
     /*DOC*/    "set the display mode\n"
 			SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 0);
 		if(depth)
 			SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, depth);
-		Py_BEGIN_ALLOW_THREADS
 		surf = SDL_SetVideoMode(w, h, depth, flags);
-		Py_END_ALLOW_THREADS
 		if(!surf)
 			return RAISE(PyExc_SDLError, SDL_GetError());
 
 	{ "mode_ok", mode_ok, 1, doc_mode_ok },
 	{ "list_modes", list_modes, 1, doc_list_modes },
 
-	{ "flip", flip, 1, doc_flip },
-	{ "update", update, 1, doc_update },
+        { "flip", flip, 1, doc_flip }, { "update", update, 1, doc_update },
 
 	{ "set_palette", set_palette, 1, doc_set_palette },
 	{ "set_gamma", set_gamma, 1, doc_set_gamma },
 	{ "get_caption", get_caption, 1, doc_get_caption },
 	{ "set_icon", set_icon, 1, doc_set_icon },
 
-	/*{ "set_icon", set_icon, 1, doc_set_icon }, need to wait for surface objects*/
 	{ "iconify", iconify, 1, doc_iconify },
 	{ "toggle_fullscreen", toggle_fullscreen, 1, doc_toggle_fullscreen },
 
+	{ "gl_set_attribute", gl_set_attribute, 1, doc_gl_set_attribute },
+	{ "gl_get_attribute", gl_get_attribute, 1, doc_gl_get_attribute },
+
 	{ NULL, NULL }
 };
 
 
                 if(channelsounds)
                 {
-/*printf("FREE CHANNELSOUNDS, %p\n", channelsounds);*/
                     for(i=0; i<numchannelsounds; ++i)
                         Py_XDECREF(channelsounds[i]);
                     free(channelsounds);
 
 	if(!PyArg_ParseTuple(arg, "|iiii", &freq, &size, &stereo, &chunk))
 		return NULL;
-	if(stereo)
+	if(stereo>=2)
 		stereo = 2;
 	else
 		stereo = 1;
 
+        if(size == 8) size = AUDIO_U8;
+        else if(size == -8) size = AUDIO_S8;
+        else if(size == 16) size = AUDIO_U16SYS;
+        else if(size == -16) size = AUDIO_S16SYS;
+        
 	/*make chunk a power of 2*/
 	for(i=0; 1<<i < chunk; ++i); //yes, semicolon on for loop
 	chunk = max(1<<i, 256);
                 
                 if(!channelsounds) /*should always be null*/
                 {
-                    channelsounds = (PyObject**)malloc(sizeof(PyObject*)*8);
-                    numchannelsounds = 8;
+                    numchannelsounds = MIX_CHANNELS;
+                    channelsounds = (PyObject**)malloc(sizeof(PyObject*)*numchannelsounds);
                     for(i=0; i < numchannelsounds; ++i)
                         channelsounds[i] = NULL;
-/*printf("ALLOC CHANNELSOUNDS, %p\n", channelsounds);*/
                 }
 
 		if(SDL_InitSubSystem(SDL_INIT_AUDIO) == -1)