ReactOS  0.4.15-dev-448-gd6c4411
card.c File Reference
#include <ntddk.h>
#include "sndblst.h"
Include dependency graph for card.c:

Go to the source code of this file.

Functions

VOID SetOutputSampleRate (ULONG BasePort, ULONG SampleRate)
 
VOID EnableSpeaker (ULONG BasePort, BOOLEAN SpeakerOn)
 
BOOLEAN IsSpeakerEnabled (ULONG BasePort)
 
VOID BeginPlayback (ULONG BasePort, ULONG BitDepth, ULONG Channels, ULONG BlockSize)
 

Function Documentation

◆ BeginPlayback()

VOID BeginPlayback ( ULONG  BasePort,
ULONG  BitDepth,
ULONG  Channels,
ULONG  BlockSize 
)

Definition at line 51 of file card.c.

52 {
53  DPRINT("BeginPlayback(%d, %d, %d, %d)\n", BasePort, BitDepth, Channels, BlockSize);
54 
55 // switch(BitDepth)
56 // {
57 // case 8 : Command = 0xc0; break;
58 // case 16 : Command = 0xb0; break; // Make sure we support it
59 // default : Command = 0xc0;
60 // }
61 
62  DPRINT("Initiating playback\n");
63 
64  // TEMPORARY:
65  SB_WRITE_BYTE(BasePort, 0xc6);
66  SB_WRITE_BYTE(BasePort, 0); // mode - TEMPORARY
67  SB_WRITE_BYTE(BasePort, BlockSize % 256);
68  SB_WRITE_BYTE(BasePort, BlockSize / 256);
69 }
#define SB_WRITE_BYTE(bp, x)
Definition: sndblst.h:84
void DPRINT(...)
Definition: polytest.cpp:61

Referenced by InitDevice().

◆ EnableSpeaker()

VOID EnableSpeaker ( ULONG  BasePort,
BOOLEAN  SpeakerOn 
)

Definition at line 25 of file card.c.

26 {
27  DPRINT("Setting speaker status %d\n", SpeakerOn);
28 
29 // if (! WaitForWrite(BasePort))
30 // return;
31 
32  SB_WRITE_BYTE(BasePort, SpeakerOn ? SB_ENABLE_SPEAKER : SB_DISABLE_SPEAKER);
33 }
#define SB_WRITE_BYTE(bp, x)
Definition: sndblst.h:84
void DPRINT(...)
Definition: polytest.cpp:61
#define SB_DISABLE_SPEAKER
Definition: sndblst.h:62
#define SB_ENABLE_SPEAKER
Definition: sndblst.h:61

◆ IsSpeakerEnabled()

BOOLEAN IsSpeakerEnabled ( ULONG  BasePort)

Definition at line 36 of file card.c.

37 {
38  DPRINT("Obtaining speaker status\n");
39 
40 // if (! WaitToSend(BasePort))
41 // return FALSE;
42 
44  if (! WaitToReceive(BasePort))
45  return FALSE;
46 
47  return SB_READ_DATA(BasePort) == 0xff;
48 }
#define SB_WRITE_BYTE(bp, x)
Definition: sndblst.h:84
void DPRINT(...)
Definition: polytest.cpp:61
BOOLEAN WaitToReceive(ULONG BasePort)
Definition: portio.c:40
#define SB_GET_SPEAKER_STATUS
Definition: sndblst.h:63
#define SB_READ_DATA(bp)
Definition: sndblst.h:70

◆ SetOutputSampleRate()

VOID SetOutputSampleRate ( ULONG  BasePort,
ULONG  SampleRate 
)

Definition at line 10 of file card.c.

11 {
12  // This only works for DSP v4.xx ONLY - need a workaround!
13  DPRINT("Setting output sample rate\n");
14 
15  // WAIT
16 // if (! WaitToSend(BasePort))
17 // return;
18 
20  SB_WRITE_BYTE(BasePort, SampleRate / 256); // high
21  SB_WRITE_BYTE(BasePort, SampleRate % 256); // low
22 }
#define SB_WRITE_BYTE(bp, x)
Definition: sndblst.h:84
void DPRINT(...)
Definition: polytest.cpp:61
#define SB_SET_OUTPUT_RATE
Definition: sndblst.h:58