home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1999 February / PCO_0299.ISO / filesbbs / linux / mikmod-3.000 / mikmod-3 / mikmod-3.1.2 / drivers / drv_nos.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-12-07  |  2.1 KB  |  109 lines

  1. /*    MikMod sound library
  2.     (c) 1998 Miodrag Vallat and others - see file AUTHORS for complete list
  3.  
  4.     This library is free software; you can redistribute it and/or modify
  5.     it under the terms of the GNU Library General Public License as
  6.     published by the Free Software Foundation; either version 2 of
  7.     the License, or (at your option) any later version.
  8.  
  9.     This program is distributed in the hope that it will be useful,
  10.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.     GNU Library General Public License for more details.
  13.  
  14.     You should have received a copy of the GNU Library General Public
  15.     License along with this library; if not, write to the Free Software
  16.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17. */
  18.  
  19. /*==============================================================================
  20.  
  21.   $Id: drv_nos.c,v 1.20 1998/12/07 06:01:53 miod Exp $
  22.  
  23.   Mikmod driver for no output
  24.  
  25. ==============================================================================*/
  26.  
  27. /*
  28.  
  29.     Written by Jean-Paul Mikkers <mikmak@via.nl>
  30.  
  31. */
  32.  
  33. #ifdef HAVE_CONFIG_H
  34. #include "config.h"
  35. #endif
  36.  
  37. #ifdef HAVE_UNISTD_H
  38. #include <unistd.h>
  39. #endif
  40.  
  41. #include <mikmod_internals.h>
  42.  
  43. /* mapping parameters */
  44. #define ZEROLEN 32768
  45.  
  46. static    SBYTE *zerobuf=NULL;
  47.  
  48. static BOOL NS_IsThere(void)
  49. {
  50.     return 1;
  51. }
  52.  
  53. static BOOL NS_Init(void)
  54. {
  55.     if(!(zerobuf=(SBYTE*)_mm_malloc(ZEROLEN)))
  56.         return 1;
  57.     return VC_Init();
  58. }
  59.  
  60. static void NS_Exit(void)
  61. {
  62.     VC_Exit();
  63.     if(zerobuf) {
  64.         free(zerobuf);
  65.         zerobuf=NULL;
  66.     }
  67. }
  68.  
  69. static BOOL NS_Reset(void)
  70. {
  71.     NS_Exit();
  72.     return NS_Init();
  73. }
  74.  
  75. static void NS_Update(void)
  76. {
  77.     if (zerobuf)
  78.         VC_WriteBytes(zerobuf,ZEROLEN);
  79. }
  80.  
  81. MDRIVER drv_nos={
  82.     NULL,
  83.     "No Sound",
  84.     "Nosound Driver v3.0",
  85.     255,255,
  86.  
  87.     NS_IsThere,
  88.     VC_SampleLoad,
  89.     VC_SampleUnload,
  90.     VC_SampleSpace,
  91.     VC_SampleLength,
  92.     NS_Init,
  93.     NS_Exit,
  94.     NS_Reset,
  95.     VC_SetNumVoices,
  96.     VC_PlayStart,
  97.     VC_PlayStop,
  98.     NS_Update,
  99.     VC_VoiceSetVolume,
  100.     VC_VoiceSetFrequency,
  101.     VC_VoiceSetPanning,
  102.     VC_VoicePlay,
  103.     VC_VoiceStop,
  104.     VC_VoiceStopped,
  105.     VC_VoiceGetPosition,
  106.     VC_VoiceRealVolume
  107. };
  108.  
  109.