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
22 SbDspIsValidInputRate(
23 IN UCHAR MajorVersion
,
24 IN UCHAR MinorVersion
,
28 if ( MajorVersion
== 1 )
33 return ( ( Rate
>= 4000 ) && ( Rate
<= 13000 ) );
35 else if ( MajorVersion
== 2 )
40 if ( MinorVersion
== 0 )
41 return ( ( Rate
>= 4000 ) && ( Rate
<= 15000 ) );
43 return ( ( Rate
>= 4000 ) && ( Rate
<= 44100 ) );
45 else if ( MajorVersion
== 3 )
50 return ( ( Rate
>= 4000 ) && ( Rate
<= 13000 ) );
52 else /* 4.00 and above */
54 return ( ( Rate
>= 5000 ) && ( Rate
<= 44100 ) );
59 SbDspIsValidOutputRate(
60 IN UCHAR MajorVersion
,
61 IN UCHAR MinorVersion
,
65 if ( MajorVersion
== 1 )
70 return ( ( Rate
>= 4000 ) && ( Rate
<= 23000 ) );
72 else if ( MajorVersion
== 2 )
77 if ( MinorVersion
== 0 )
78 return ( ( Rate
>= 4000 ) && ( Rate
<= 23000 ) );
80 return ( ( Rate
>= 4000 ) && ( Rate
<= 44100 ) );
82 else if ( MajorVersion
== 3 )
85 return ( ( Rate
>= 4000 ) && ( Rate
<= 44100 ) );
87 return ( ( Rate
>= 11025 ) && ( Rate
<= 22050 ) );
89 else /* 4.00 and above */
91 return ( ( Rate
>= 5000 ) && ( Rate
<= 44100 ) );
95 /* Internal routine - call only after submitting one of the rate commands */
104 /* NOTE - No check for validity of rate! */
106 /* Write high byte */
107 Status
= SbDspWrite(BasePort
, (Rate
& 0xff00) >> 8, Timeout
);
108 if ( Status
!= STATUS_SUCCESS
)
112 Status
= SbDspWrite(BasePort
, Rate
& 0xff, Timeout
);
113 if ( Status
!= STATUS_SUCCESS
)
127 /* NOTE - No check for validity of rate! */
129 /* Prepare to write the output rate */
130 Status
= SbDspWrite(BasePort
, SB_DSP_OUTPUT_RATE
, (Rate
& 0xff00) >> 8);
131 if ( Status
!= STATUS_SUCCESS
)
134 return SbDsp4WriteRate(BasePort
, Rate
, Timeout
);
145 /* NOTE - No check for validity of rate! */
147 /* Prepare to write the input rate */
148 Status
= SbDspWrite(BasePort
, SB_DSP_OUTPUT_RATE
, (Rate
& 0xff00) >> 8);
149 if ( Status
!= STATUS_SUCCESS
)
152 return SbDsp4WriteRate(BasePort
, Rate
, Timeout
);