ReactOS  0.4.15-dev-5122-g72bdbdd
mixer.c File Reference
#include "precomp.h"
Include dependency graph for mixer.c:

Go to the source code of this file.

Functions

VOID SbMixerReset (IN PUCHAR BasePort)
 
NTSTATUS SbMixerPackLevelData (IN UCHAR Line, IN UCHAR Level, OUT PUCHAR PackedLevel)
 
NTSTATUS SbMixerUnpackLevelData (IN UCHAR Line, IN UCHAR PackedLevel, OUT PUCHAR Level)
 
NTSTATUS SbMixerSetLevel (IN PUCHAR BasePort, IN UCHAR Line, IN UCHAR Level)
 
NTSTATUS SbMixerGetLevel (IN PUCHAR BasePort, IN UCHAR Line, OUT PUCHAR Level)
 
VOID SbMixerEnableAGC (IN PUCHAR BasePort)
 
VOID SbMixerDisableAGC (IN PUCHAR BasePort)
 
BOOLEAN SbMixerIsAGCEnabled (IN PUCHAR BasePort)
 

Function Documentation

◆ SbMixerDisableAGC()

VOID SbMixerDisableAGC ( IN PUCHAR  BasePort)

Definition at line 230 of file mixer.c.

231 {
232  /* Untested... */
234  WRITE_SB_MIXER_DATA(BasePort, 0);
235 }
#define WRITE_SB_MIXER_DATA(bp, x)
Definition: sbdsp.h:45
#define WRITE_SB_MIXER_REGISTER(bp, x)
Definition: sbdsp.h:43
#define SB_MIX_AGC
Definition: sbdsp.h:113

◆ SbMixerEnableAGC()

VOID SbMixerEnableAGC ( IN PUCHAR  BasePort)

Definition at line 222 of file mixer.c.

223 {
224  /* Untested... */
226  WRITE_SB_MIXER_DATA(BasePort, 1);
227 }
#define WRITE_SB_MIXER_DATA(bp, x)
Definition: sbdsp.h:45
#define WRITE_SB_MIXER_REGISTER(bp, x)
Definition: sbdsp.h:43
#define SB_MIX_AGC
Definition: sbdsp.h:113

◆ SbMixerGetLevel()

NTSTATUS SbMixerGetLevel ( IN PUCHAR  BasePort,
IN UCHAR  Line,
OUT PUCHAR  Level 
)

Definition at line 185 of file mixer.c.

189 {
190  UCHAR PackedLevel = 0;
192 
193  if ( ! Level )
195 
196  WRITE_SB_MIXER_REGISTER(BasePort, Line);
197  PackedLevel = READ_SB_MIXER_DATA(BasePort);
198 
199  Status = SbMixerUnpackLevelData(Line, PackedLevel, Level);
200 
201  switch ( Status )
202  {
203  case STATUS_SUCCESS :
204  break;
205 
208 
211 
212  default :
213  return Status;
214  };
215 
216  DbgPrint("SbMixerGetLevel: Line 0x%x, raw level 0x%x, packed 0x%x\n", Line, Level, PackedLevel);
217 
218  return STATUS_SUCCESS;
219 }
#define DbgPrint
Definition: hal.h:12
LONG NTSTATUS
Definition: precomp.h:26
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:55
NTSTATUS SbMixerUnpackLevelData(IN UCHAR Line, IN UCHAR PackedLevel, OUT PUCHAR Level)
Definition: mixer.c:96
#define STATUS_INVALID_PARAMETER_3
Definition: ntstatus.h:477
#define WRITE_SB_MIXER_REGISTER(bp, x)
Definition: sbdsp.h:43
#define STATUS_INVALID_PARAMETER_2
Definition: ntstatus.h:476
Status
Definition: gdiplustypes.h:24
#define READ_SB_MIXER_DATA(bp)
Definition: sbdsp.h:44
Definition: ncftp.h:79
unsigned char UCHAR
Definition: xmlstorage.h:181
#define STATUS_INVALID_PARAMETER_1
Definition: ntstatus.h:475
#define STATUS_SUCCESS
Definition: shellext.h:65

◆ SbMixerIsAGCEnabled()

BOOLEAN SbMixerIsAGCEnabled ( IN PUCHAR  BasePort)

Definition at line 238 of file mixer.c.

239 {
240  /* Untested... */
242  return (READ_SB_MIXER_DATA(BasePort) != 0);
243 }
#define WRITE_SB_MIXER_REGISTER(bp, x)
Definition: sbdsp.h:43
#define READ_SB_MIXER_DATA(bp)
Definition: sbdsp.h:44
#define SB_MIX_AGC
Definition: sbdsp.h:113

◆ SbMixerPackLevelData()

NTSTATUS SbMixerPackLevelData ( IN UCHAR  Line,
IN UCHAR  Level,
OUT PUCHAR  PackedLevel 
)

Definition at line 31 of file mixer.c.

35 {
36  if ( ! PackedLevel )
38 
39  switch ( Line )
40  {
51  case SB_MIX_MIC_LEVEL :
52  case SB_MIX_LEGACY_MIC_LEVEL : /* is this correct? */
53  {
54  if ( Level >= 0x20 )
56 
57  *PackedLevel = Level << 3;
58  return STATUS_SUCCESS;
59  }
60 
65  {
66  if ( Level >= 0x04 )
68 
69  *PackedLevel = Level << 6;
70  return STATUS_SUCCESS;
71  }
72 
73  case SB_MIX_VOC_LEVEL : /* legacy */
74  case SB_MIX_MASTER_LEVEL :
75  case SB_MIX_FM_LEVEL :
76  case SB_MIX_CD_LEVEL :
77  case SB_MIX_LINE_LEVEL :
78  case SB_MIX_TREBLE_LEFT_LEVEL : /* bass/treble */
82  {
83  if ( Level >= 0x10 )
85 
86  *PackedLevel = Level << 4;
87  return STATUS_SUCCESS;
88  }
89 
90  default :
92  };
93 }
#define SB_MIX_VOC_LEFT_LEVEL
Definition: sbdsp.h:96
#define SB_MIX_LEGACY_MIC_LEVEL
Definition: sbdsp.h:84
#define SB_MIX_LINE_LEVEL
Definition: sbdsp.h:88
#define SB_MIX_CD_LEFT_LEVEL
Definition: sbdsp.h:100
#define SB_MIX_MASTER_RIGHT_LEVEL
Definition: sbdsp.h:95
#define SB_MIX_MASTER_LEVEL
Definition: sbdsp.h:85
#define SB_MIX_BASS_LEFT_LEVEL
Definition: sbdsp.h:116
#define SB_MIX_LINE_RIGHT_LEVEL
Definition: sbdsp.h:103
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:55
#define SB_MIX_OUTPUT_RIGHT_GAIN
Definition: sbdsp.h:112
#define SB_MIX_CD_LEVEL
Definition: sbdsp.h:87
#define SB_MIX_TREBLE_LEFT_LEVEL
Definition: sbdsp.h:114
#define SB_MIX_CD_RIGHT_LEVEL
Definition: sbdsp.h:101
#define SB_MIX_MIC_LEVEL
Definition: sbdsp.h:104
#define SB_MIX_OUTPUT_LEFT_GAIN
Definition: sbdsp.h:111
#define SB_MIX_TREBLE_RIGHT_LEVEL
Definition: sbdsp.h:115
#define SB_MIX_FM_LEVEL
Definition: sbdsp.h:86
#define STATUS_INVALID_PARAMETER_3
Definition: ntstatus.h:477
#define SB_MIX_INPUT_RIGHT_GAIN
Definition: sbdsp.h:110
#define SB_MIX_VOC_RIGHT_LEVEL
Definition: sbdsp.h:97
#define SB_MIX_INPUT_LEFT_GAIN
Definition: sbdsp.h:109
#define STATUS_INVALID_PARAMETER_2
Definition: ntstatus.h:476
#define SB_MIX_MIDI_LEFT_LEVEL
Definition: sbdsp.h:98
Definition: ncftp.h:79
#define SB_MIX_MIDI_RIGHT_LEVEL
Definition: sbdsp.h:99
#define STATUS_INVALID_PARAMETER_1
Definition: ntstatus.h:475
#define SB_MIX_VOC_LEVEL
Definition: sbdsp.h:83
#define SB_MIX_MASTER_LEFT_LEVEL
Definition: sbdsp.h:94
#define SB_MIX_BASS_RIGHT_LEVEL
Definition: sbdsp.h:117
#define STATUS_SUCCESS
Definition: shellext.h:65
#define SB_MIX_LINE_LEFT_LEVEL
Definition: sbdsp.h:102

Referenced by SbMixerSetLevel().

◆ SbMixerReset()

VOID SbMixerReset ( IN PUCHAR  BasePort)

Definition at line 24 of file mixer.c.

25 {
27  /* Are we meant to send anything else? */
28 }
#define SB_MIX_RESET
Definition: sbdsp.h:93
#define WRITE_SB_MIXER_REGISTER(bp, x)
Definition: sbdsp.h:43

◆ SbMixerSetLevel()

NTSTATUS SbMixerSetLevel ( IN PUCHAR  BasePort,
IN UCHAR  Line,
IN UCHAR  Level 
)

Definition at line 151 of file mixer.c.

155 {
156  UCHAR PackedLevel = 0;
158 
159  Status = SbMixerPackLevelData(Line, Level, &PackedLevel);
160 
161  switch ( Status )
162  {
163  case STATUS_SUCCESS :
164  break;
165 
168 
171 
172  default :
173  return Status;
174  };
175 
176  DbgPrint("SbMixerSetLevel: Line 0x%x, raw level 0x%x, packed 0x%x\n", Line, Level, PackedLevel);
177 
178  WRITE_SB_MIXER_REGISTER(BasePort, Line);
179  WRITE_SB_MIXER_DATA(BasePort, PackedLevel);
180 
181  return STATUS_SUCCESS;
182 }
#define DbgPrint
Definition: hal.h:12
LONG NTSTATUS
Definition: precomp.h:26
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:55
#define WRITE_SB_MIXER_DATA(bp, x)
Definition: sbdsp.h:45
#define STATUS_INVALID_PARAMETER_3
Definition: ntstatus.h:477
#define WRITE_SB_MIXER_REGISTER(bp, x)
Definition: sbdsp.h:43
#define STATUS_INVALID_PARAMETER_2
Definition: ntstatus.h:476
Status
Definition: gdiplustypes.h:24
Definition: ncftp.h:79
unsigned char UCHAR
Definition: xmlstorage.h:181
#define STATUS_INVALID_PARAMETER_1
Definition: ntstatus.h:475
NTSTATUS SbMixerPackLevelData(IN UCHAR Line, IN UCHAR Level, OUT PUCHAR PackedLevel)
Definition: mixer.c:31
#define STATUS_SUCCESS
Definition: shellext.h:65

◆ SbMixerUnpackLevelData()

NTSTATUS SbMixerUnpackLevelData ( IN UCHAR  Line,
IN UCHAR  PackedLevel,
OUT PUCHAR  Level 
)

Definition at line 96 of file mixer.c.

100 {
101  if ( ! Level )
103 
104  switch ( Line )
105  {
108  case SB_MIX_VOC_LEFT_LEVEL :
112  case SB_MIX_CD_LEFT_LEVEL :
113  case SB_MIX_CD_RIGHT_LEVEL :
116  case SB_MIX_MIC_LEVEL :
117  {
118  *Level = PackedLevel >> 3;
119  return STATUS_SUCCESS;
120  }
121 
126  {
127  *Level = PackedLevel >> 6;
128  return STATUS_SUCCESS;
129  }
130 
131  case SB_MIX_VOC_LEVEL : /* legacy */
132  case SB_MIX_MASTER_LEVEL :
133  case SB_MIX_FM_LEVEL :
134  case SB_MIX_CD_LEVEL :
135  case SB_MIX_LINE_LEVEL :
136  case SB_MIX_TREBLE_LEFT_LEVEL : /* bass/treble */
140  {
141  *Level = PackedLevel >> 4;
142  return STATUS_SUCCESS;
143  }
144 
145  default :
147  };
148 }
#define SB_MIX_VOC_LEFT_LEVEL
Definition: sbdsp.h:96
#define SB_MIX_LINE_LEVEL
Definition: sbdsp.h:88
#define SB_MIX_CD_LEFT_LEVEL
Definition: sbdsp.h:100
#define SB_MIX_MASTER_RIGHT_LEVEL
Definition: sbdsp.h:95
#define SB_MIX_MASTER_LEVEL
Definition: sbdsp.h:85
#define SB_MIX_BASS_LEFT_LEVEL
Definition: sbdsp.h:116
#define SB_MIX_LINE_RIGHT_LEVEL
Definition: sbdsp.h:103
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:55
#define SB_MIX_OUTPUT_RIGHT_GAIN
Definition: sbdsp.h:112
#define SB_MIX_CD_LEVEL
Definition: sbdsp.h:87
#define SB_MIX_TREBLE_LEFT_LEVEL
Definition: sbdsp.h:114
#define SB_MIX_CD_RIGHT_LEVEL
Definition: sbdsp.h:101
#define SB_MIX_MIC_LEVEL
Definition: sbdsp.h:104
#define SB_MIX_OUTPUT_LEFT_GAIN
Definition: sbdsp.h:111
#define SB_MIX_TREBLE_RIGHT_LEVEL
Definition: sbdsp.h:115
#define SB_MIX_FM_LEVEL
Definition: sbdsp.h:86
#define STATUS_INVALID_PARAMETER_3
Definition: ntstatus.h:477
#define SB_MIX_INPUT_RIGHT_GAIN
Definition: sbdsp.h:110
#define SB_MIX_VOC_RIGHT_LEVEL
Definition: sbdsp.h:97
#define SB_MIX_INPUT_LEFT_GAIN
Definition: sbdsp.h:109
#define SB_MIX_MIDI_LEFT_LEVEL
Definition: sbdsp.h:98
Definition: ncftp.h:79
#define SB_MIX_MIDI_RIGHT_LEVEL
Definition: sbdsp.h:99
#define STATUS_INVALID_PARAMETER_1
Definition: ntstatus.h:475
#define SB_MIX_VOC_LEVEL
Definition: sbdsp.h:83
#define SB_MIX_MASTER_LEFT_LEVEL
Definition: sbdsp.h:94
#define SB_MIX_BASS_RIGHT_LEVEL
Definition: sbdsp.h:117
#define STATUS_SUCCESS
Definition: shellext.h:65
#define SB_MIX_LINE_LEFT_LEVEL
Definition: sbdsp.h:102

Referenced by SbMixerGetLevel().