Exemple #1
0
BOOLEAN
SoundTestInterruptAndDMA(
    IN	PGLOBAL_DEVICE_INFO pGDI
)
//
// Check if the interrupt and DMA settings work with the card
// If not we beat a hasty retreat and hope we haven't broken anything!
//
{
    int Error;

    Error = SoundTestWaveDevice(pGDI->DeviceObject[WaveOutDevice]);


#if DBG
    if (Error)
	dprintf2(("SoundTestInterruptAndDMA: Error during SoundTestWaveDevice(WaveOut)."));
#endif


    if (Error == 0) {
	 Error = SoundTestWaveDevice(pGDI->DeviceObject[WaveInDevice]);


#if DBG
       if (Error)
	  dprintf2(("SoundTestInterruptAndDMA: Error during SoundTestWaveDevice(WaveIn)."));
#endif


    }

    //
    // Make sure everything gets finished
    //

    HwSetWaveFormat(&pGDI->WaveInfo);

    if (Error != 0) {
	SoundSetErrorCode(pGDI->RegistryPathName,
			  Error == 1 ? SOUND_CONFIG_BADINT
				     : SOUND_CONFIG_BADDMA);
	return FALSE;
    } else {
	return TRUE;
    }
}
/*ARGSUSED*/
static int
allegro_audio_prepare_for_input (int dev, int bsize, int bcount)
{
  allegro_devc *devc = audio_engines[dev]->devc;
  allegro_portc *portc = audio_engines[dev]->portc;
  oss_native_word flags;
  WAVE_INFO WaveInfo;

  MUTEX_ENTER_IRQDISABLE (devc->mutex, flags);
  WaveInfo.BitsPerSample = portc->bits;
  WaveInfo.Channels = portc->channels;
  WaveInfo.SamplesPerSec = portc->speed;

  HwSetWaveFormat (devc, &WaveInfo, FALSE);
  MUTEX_EXIT_IRQRESTORE (devc->mutex, flags);

  portc->audio_enabled &= ~PCM_ENABLE_INPUT;
  portc->trigger_bits &= ~PCM_ENABLE_INPUT;
  return 0;
}
/*ARGSUSED*/
static int
allegro_audio_prepare_for_output (int dev, int bsize, int bcount)
{
  allegro_devc *devc = audio_engines[dev]->devc;
  allegro_portc *portc = audio_engines[dev]->portc;
  oss_native_word flags;
  WAVE_INFO WaveInfo;

  MUTEX_ENTER_IRQDISABLE (devc->mutex, flags);
  WaveInfo.BitsPerSample = portc->bits;
  WaveInfo.Channels = portc->channels;
  WaveInfo.SamplesPerSec = portc->speed;
  SRCMGR_SetVolume (devc, PlaybackStream->DspClientInstance, 0x7FFF, 0x7FFF);

  HwSetWaveFormat (devc, &WaveInfo, TRUE);
  MUTEX_EXIT_IRQRESTORE (devc->mutex, flags);

  portc->audio_enabled &= ~PCM_ENABLE_OUTPUT;
  portc->trigger_bits &= ~PCM_ENABLE_OUTPUT;
  return 0;
}