Example #1
0
static UMSAudioDevice_ReturnCode UADSetVolume(_THIS,  long volume )
{
    /*
     * Set the volume.
     * Takes effect immediately.
     */
    return UMSAudioDevice_set_volume( this->hidden->umsdev,
				      this->hidden->ev,
				      volume );
}
Example #2
0
static int aix_init(const char *param, int *speed,
		    int *fragsize, int *fragnr, int *channels)
{
    int	st, tmp, i;

    /* No stereo capability. */
    *channels = 1;

    /* open device */
    ev = somGetGlobalEnvironment();
    audio_device = UMSBAUDDeviceNew();
    rc = UMSAudioDevice_open(audio_device, ev, "/dev/paud0", "PLAY",
			     UMSAudioDevice_BlockingIO);
    if (audio_device == NULL)
    {
    	fprintf(errfile,"can't create audio device object\nError: %s\n",
		error_string);
	return 1;
    }

    rc = UMSAudioDevice_set_volume(audio_device, ev, 100);
    rc = UMSAudioDevice_set_balance(audio_device, ev, 0);

    rc = UMSAudioDevice_set_time_format(audio_device, ev, UMSAudioTypes_Msecs);

    if (obyte_order)
        lib_free(obyte_order);
    rc = UMSAudioDevice_set_byte_order(audio_device, ev, "LSB");

    /* set 16bit */
    rc = UMSAudioDevice_set_bits_per_sample(audio_device, ev, 16);
    rc = UMSAudioDevice_set_audio_format_type(audio_device, ev, "PCM");
    rc = UMSAudioDevice_set_number_format(audio_device, ev, "TWOS_COMPLEMENT");

    /* set speed */
    rc = UMSAudioDevice_set_sample_rate(audio_device, ev, *speed, &out_rate);

    /* channels */
    rc = UMSAudioDevice_set_number_of_channels(audio_device, ev, 1);

    /* should we use the default? */
    left_gain = right_gain = 100;
    rc = UMSAudioDevice_enable_output(audio_device, ev, "LINE_OUT",
				      &left_gain, &right_gain);

    /* set buffer size */
    tmp = (*fragsize) * (*fragnr) * sizeof(SWORD);
    buffer._maximum = tmp;
    buffer._buffer  = (char *)lib_malloc(tmp);
    buffer._length = 0;


    rc = UMSAudioDevice_initialize(audio_device, ev);
    rc = UMSAudioDevice_start(audio_device, ev);

    return 0;
#if 0
    /* XXX: AIX: everything should check rc, this isn't used now */
fail:
    UMSAudioDevice_stop(audio_device, ev);
    UMSAudioDevice_close(audio_device, ev);
    _somFree(audio_device);
    lib_free(buffer._buffer);
    audio_device = NULL;

    return 1;
#endif
}