/* call-seq: * open_audio( frequency, format, channels, samplesize) * * Initializes the audio device. You must call this before using the other * mixer functions. See also #close_audio(). * * Returns nil. May raise an SDLError if initialization fails. * * This method takes these arguments: * frequency:: output sampling frequency in samples per second (Hz). * 22050 is recommended for most games; 44100 is CD audio * rate. The larger the value, the more processing required. * format:: output sample format. * channels:: output sound channels. Use 2 for stereo, 1 for mono. * (this option does not affect number of mixing channels) * samplesize:: bytes per output sample. * */ VALUE rbgm_mixer_openaudio(VALUE module, VALUE frequencyv, VALUE formatv, VALUE channelsv, VALUE samplesizev) { int frequency, channels, samplesize; Uint16 format; frequency = NUM2INT(frequencyv); format = NUM2UINT(formatv); channels = NUM2INT(channelsv); samplesize = NUM2INT(samplesizev); if ( Mix_OpenAudio(frequency, format, channels, samplesize) < 0 ) { rb_raise(eSDLError, "Error initializing SDL_mixer: %s", Mix_GetError()); } return Qnil; }