grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / devs / AHI / Drivers / Alsa / alsa-init.c
blob6e89347fcb9105f42b0e3d7fd3545bbe80469873
2 #include <aros/debug.h>
3 #include <config.h>
5 #include "library.h"
6 #include "DriverData.h"
8 #include "alsa-bridge/alsa.h"
10 /******************************************************************************
11 ** Custom driver init *********************************************************
12 ******************************************************************************/
14 BOOL
15 DriverInit( struct DriverBase* AHIsubBase )
17 struct AlsaBase* AlsaBase = (struct AlsaBase*) AHIsubBase;
19 D(bug("[Alsa]: DriverInit()\n"));
21 AlsaBase->dosbase = (struct DosLibrary *)OpenLibrary( DOSNAME, 37 );
23 if( AlsaBase->dosbase == NULL )
25 Req( "Unable to open 'dos.library' version 37.\n" );
26 return FALSE;
29 if (!ALSA_Init())
30 return FALSE;
33 ALSA_MixerInit(&AlsaBase->al_MixerHandle, &AlsaBase->al_MixerElem,
34 &AlsaBase->al_MinVolume, &AlsaBase->al_MaxVolume);
36 D(bug("[Alsa]: DriverInit() completed\n"));
38 return TRUE;
42 /******************************************************************************
43 ** Custom driver clean-up *****************************************************
44 ******************************************************************************/
46 VOID
47 DriverCleanup( struct DriverBase* AHIsubBase )
49 struct AlsaBase* AlsaBase = (struct AlsaBase*) AHIsubBase;
51 ALSA_Cleanup();
53 if (AlsaBase->al_MixerHandle)
54 ALSA_MixerCleanup(AlsaBase->al_MixerHandle);
56 CloseLibrary( (struct Library*) DOSBase );