ReactOS 0.4.15-dev-8191-gbc6c731
rate.c File Reference
#include "precomp.h"
Include dependency graph for rate.c:

Go to the source code of this file.

Functions

BOOLEAN SbDspIsValidInputRate (IN UCHAR MajorVersion, IN UCHAR MinorVersion, IN USHORT Rate, IN BOOLEAN Stereo)
 
BOOLEAN SbDspIsValidOutputRate (IN UCHAR MajorVersion, IN UCHAR MinorVersion, IN USHORT Rate, IN BOOLEAN Stereo)
 
NTSTATUS SbDsp4WriteRate (IN PUCHAR BasePort, IN USHORT Rate, IN ULONG Timeout)
 
NTSTATUS SbDsp4SetOutputRate (IN PUCHAR BasePort, IN USHORT Rate, IN ULONG Timeout)
 
NTSTATUS SbDsp4SetInputRate (IN PUCHAR BasePort, IN USHORT Rate, IN ULONG Timeout)
 

Function Documentation

◆ SbDsp4SetInputRate()

NTSTATUS SbDsp4SetInputRate ( IN PUCHAR  BasePort,
IN USHORT  Rate,
IN ULONG  Timeout 
)

Definition at line 135 of file rate.c.

139{
141
142 /* NOTE - No check for validity of rate! */
143
144 /* Prepare to write the input rate */
145 Status = SbDspWrite(BasePort, SB_DSP_OUTPUT_RATE, (Rate & 0xff00) >> 8);
146 if ( Status != STATUS_SUCCESS )
147 return Status;
148
149 return SbDsp4WriteRate(BasePort, Rate, Timeout);
150}
LONG NTSTATUS
Definition: precomp.h:26
Status
Definition: gdiplustypes.h:25
static ULONG Timeout
Definition: ping.c:61
NTSTATUS SbDsp4WriteRate(IN PUCHAR BasePort, IN USHORT Rate, IN ULONG Timeout)
Definition: rate.c:94
NTSTATUS SbDspWrite(IN PUCHAR BasePort, IN UCHAR DataByte, IN ULONG Timeout)
Definition: dsp_io.c:99
#define SB_DSP_OUTPUT_RATE
Definition: sbdsp.h:72
#define STATUS_SUCCESS
Definition: shellext.h:65

◆ SbDsp4SetOutputRate()

NTSTATUS SbDsp4SetOutputRate ( IN PUCHAR  BasePort,
IN USHORT  Rate,
IN ULONG  Timeout 
)

Definition at line 117 of file rate.c.

121{
123
124 /* NOTE - No check for validity of rate! */
125
126 /* Prepare to write the output rate */
127 Status = SbDspWrite(BasePort, SB_DSP_OUTPUT_RATE, (Rate & 0xff00) >> 8);
128 if ( Status != STATUS_SUCCESS )
129 return Status;
130
131 return SbDsp4WriteRate(BasePort, Rate, Timeout);
132}

◆ SbDsp4WriteRate()

NTSTATUS SbDsp4WriteRate ( IN PUCHAR  BasePort,
IN USHORT  Rate,
IN ULONG  Timeout 
)

Definition at line 94 of file rate.c.

98{
100
101 /* NOTE - No check for validity of rate! */
102
103 /* Write high byte */
104 Status = SbDspWrite(BasePort, (Rate & 0xff00) >> 8, Timeout);
105 if ( Status != STATUS_SUCCESS )
106 return Status;
107
108 /* Write low byte */
109 Status = SbDspWrite(BasePort, Rate & 0xff, Timeout);
110 if ( Status != STATUS_SUCCESS )
111 return Status;
112
113 return Status;
114}

Referenced by SbDsp4SetInputRate(), and SbDsp4SetOutputRate().

◆ SbDspIsValidInputRate()

BOOLEAN SbDspIsValidInputRate ( IN UCHAR  MajorVersion,
IN UCHAR  MinorVersion,
IN USHORT  Rate,
IN BOOLEAN  Stereo 
)

Definition at line 19 of file rate.c.

24{
25 if ( MajorVersion == 1 )
26 {
27 if ( Stereo )
28 return FALSE;
29
30 return ( ( Rate >= 4000 ) && ( Rate <= 13000 ) );
31 }
32 else if ( MajorVersion == 2 )
33 {
34 if ( Stereo )
35 return FALSE;
36
37 if ( MinorVersion == 0 )
38 return ( ( Rate >= 4000 ) && ( Rate <= 15000 ) );
39 else
40 return ( ( Rate >= 4000 ) && ( Rate <= 44100 ) );
41 }
42 else if ( MajorVersion == 3 )
43 {
44 if ( Stereo )
45 return FALSE;
46
47 return ( ( Rate >= 4000 ) && ( Rate <= 13000 ) );
48 }
49 else /* 4.00 and above */
50 {
51 return ( ( Rate >= 5000 ) && ( Rate <= 44100 ) );
52 }
53}
#define FALSE
Definition: types.h:117
ULONG MajorVersion
Definition: ros_glue.cpp:4
ULONG MinorVersion
Definition: ros_glue.cpp:5

◆ SbDspIsValidOutputRate()

BOOLEAN SbDspIsValidOutputRate ( IN UCHAR  MajorVersion,
IN UCHAR  MinorVersion,
IN USHORT  Rate,
IN BOOLEAN  Stereo 
)

Definition at line 56 of file rate.c.

61{
62 if ( MajorVersion == 1 )
63 {
64 if ( Stereo )
65 return FALSE;
66
67 return ( ( Rate >= 4000 ) && ( Rate <= 23000 ) );
68 }
69 else if ( MajorVersion == 2 )
70 {
71 if ( Stereo )
72 return FALSE;
73
74 if ( MinorVersion == 0 )
75 return ( ( Rate >= 4000 ) && ( Rate <= 23000 ) );
76 else
77 return ( ( Rate >= 4000 ) && ( Rate <= 44100 ) );
78 }
79 else if ( MajorVersion == 3 )
80 {
81 if ( ! Stereo )
82 return ( ( Rate >= 4000 ) && ( Rate <= 44100 ) );
83 else
84 return ( ( Rate >= 11025 ) && ( Rate <= 22050 ) );
85 }
86 else /* 4.00 and above */
87 {
88 return ( ( Rate >= 5000 ) && ( Rate <= 44100 ) );
89 }
90}