3 Sound Blaster DSP support
7 Andrew Greenwood (silverblade@reactos.org)
10 2 July 2008 - Created (split from sbdsp.c)
13 Functions documented in sbdsp.h
19 SbDspIsValidInputRate(
20 IN UCHAR MajorVersion
,
21 IN UCHAR MinorVersion
,
25 if ( MajorVersion
== 1 )
30 return ( ( Rate
>= 4000 ) && ( Rate
<= 13000 ) );
32 else if ( MajorVersion
== 2 )
37 if ( MinorVersion
== 0 )
38 return ( ( Rate
>= 4000 ) && ( Rate
<= 15000 ) );
40 return ( ( Rate
>= 4000 ) && ( Rate
<= 44100 ) );
42 else if ( MajorVersion
== 3 )
47 return ( ( Rate
>= 4000 ) && ( Rate
<= 13000 ) );
49 else /* 4.00 and above */
51 return ( ( Rate
>= 5000 ) && ( Rate
<= 44100 ) );
56 SbDspIsValidOutputRate(
57 IN UCHAR MajorVersion
,
58 IN UCHAR MinorVersion
,
62 if ( MajorVersion
== 1 )
67 return ( ( Rate
>= 4000 ) && ( Rate
<= 23000 ) );
69 else if ( MajorVersion
== 2 )
74 if ( MinorVersion
== 0 )
75 return ( ( Rate
>= 4000 ) && ( Rate
<= 23000 ) );
77 return ( ( Rate
>= 4000 ) && ( Rate
<= 44100 ) );
79 else if ( MajorVersion
== 3 )
82 return ( ( Rate
>= 4000 ) && ( Rate
<= 44100 ) );
84 return ( ( Rate
>= 11025 ) && ( Rate
<= 22050 ) );
86 else /* 4.00 and above */
88 return ( ( Rate
>= 5000 ) && ( Rate
<= 44100 ) );
92 /* Internal routine - call only after submitting one of the rate commands */
101 /* NOTE - No check for validity of rate! */
103 /* Write high byte */
104 Status
= SbDspWrite(BasePort
, (Rate
& 0xff00) >> 8, Timeout
);
105 if ( Status
!= STATUS_SUCCESS
)
109 Status
= SbDspWrite(BasePort
, Rate
& 0xff, Timeout
);
110 if ( Status
!= STATUS_SUCCESS
)
124 /* NOTE - No check for validity of rate! */
126 /* Prepare to write the output rate */
127 Status
= SbDspWrite(BasePort
, SB_DSP_OUTPUT_RATE
, (Rate
& 0xff00) >> 8);
128 if ( Status
!= STATUS_SUCCESS
)
131 return SbDsp4WriteRate(BasePort
, Rate
, Timeout
);
142 /* NOTE - No check for validity of rate! */
144 /* Prepare to write the input rate */
145 Status
= SbDspWrite(BasePort
, SB_DSP_OUTPUT_RATE
, (Rate
& 0xff00) >> 8);
146 if ( Status
!= STATUS_SUCCESS
)
149 return SbDsp4WriteRate(BasePort
, Rate
, Timeout
);