convert line ends
[canaan.git] / prj / tech / libsrc / sndutil / utilmain.c
blobba2aea10db93c88a818ba12744e51c9a06be0e27
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // (c) 1996 Looking Glass Technologies Inc.
4 // Pat McElhatton
5 //
6 // Module name: Sound utilities standalone main routines
7 // File name: utilmain.c
8 //
9 // Description: Set of functions for setting up sound library which
10 // are used by several standalone programs
12 ////////////////////////////////////////////////////////////////////////
14 #include <windows.h>
15 #include <lg.h>
16 #include <mprintf.h>
17 #include <stdio.h>
18 #include <stdlib.h>
19 #include <lgsound.h>
20 #include <utilmain.h>
23 ////////////////////////////////////////////////////////////////////////
25 // Function name: SoundInit()
27 // Description: Initialize the sound module.
29 ////////////////////////////////////////////////////////////////////////
30 ISndMixer *
31 SoundInit ( void )
33 ISndMixer *pMixer = NULL;
35 if (SndCreateMixer (&pMixer, NULL) == FALSE) {
36 printf ("Sound system not started\n");
37 } else {
38 sSndSetup setup;
39 setup.hwnd = NULL;
41 if (ISndMixer_Init (pMixer, &setup, MAX_SOUNDS, NULL) != kSndOk) {
42 printf ("Sound system init failed\n");
46 return pMixer;
50 ////////////////////////////////////////////////////////////////////////
52 // Function name: SoundTerm()
54 // Description: Terminate the sound module.
56 ////////////////////////////////////////////////////////////////////////
57 void
58 SoundTerm ( ISndMixer *pMixer )
60 if (pMixer) {
61 ISndMixer_StopAllSamples (pMixer);
62 ISndMixer_Release (pMixer);
63 pMixer = NULL;
68 ////////////////////////////////////////////////////////////////////////
70 // Function name: SoundRecur()
72 // Description: Recur into the sound module for management purposes.
74 ////////////////////////////////////////////////////////////////////////
75 void
76 SoundRecur( ISndMixer *pMixer )
78 if ( pMixer ) {
79 // allow any samples which have finished playing to do
80 // end-of-sample cleanup
81 ISndMixer_Update( pMixer );