ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

card.c
Go to the documentation of this file.
00001 /*
00002     Sound card operations
00003 
00004     http://www.cae.wisc.edu/~brodskye/sb16doc/sb16doc.html
00005 */
00006 
00007 #include <ntddk.h>
00008 #include "sndblst.h"
00009 
00010 VOID SetOutputSampleRate(ULONG BasePort, ULONG SampleRate)
00011 {
00012     // This only works for DSP v4.xx ONLY - need a workaround!
00013     DPRINT("Setting output sample rate\n");
00014 
00015     // WAIT
00016 //    if (! WaitToSend(BasePort))
00017 //        return;
00018 
00019     SB_WRITE_BYTE(BasePort, SB_SET_OUTPUT_RATE);
00020     SB_WRITE_BYTE(BasePort, SampleRate / 256);  // high
00021     SB_WRITE_BYTE(BasePort, SampleRate % 256);  // low
00022 }
00023 
00024 
00025 VOID EnableSpeaker(ULONG BasePort, BOOLEAN SpeakerOn)
00026 {
00027     DPRINT("Setting speaker status %d\n", SpeakerOn);
00028 
00029 //    if (! WaitForWrite(BasePort))
00030 //        return;
00031 
00032     SB_WRITE_BYTE(BasePort, SpeakerOn ? SB_ENABLE_SPEAKER : SB_DISABLE_SPEAKER);
00033 }
00034 
00035 
00036 BOOLEAN IsSpeakerEnabled(ULONG BasePort)
00037 {
00038     DPRINT("Obtaining speaker status\n");
00039 
00040 //    if (! WaitToSend(BasePort))
00041 //        return FALSE;
00042 
00043     SB_WRITE_BYTE(BasePort, SB_GET_SPEAKER_STATUS);
00044     if (! WaitToReceive(BasePort))
00045         return FALSE;
00046 
00047     return SB_READ_DATA(BasePort) == 0xff;
00048 }
00049 
00050 
00051 VOID BeginPlayback(ULONG BasePort, ULONG BitDepth, ULONG Channels, ULONG BlockSize)
00052 {
00053     DPRINT("BeginPlayback(%d, %d, %d, %d)\n", BasePort, BitDepth, Channels, BlockSize);
00054 
00055 //    switch(BitDepth)
00056 //    {
00057 //        case 8 :    Command = 0xc0; break;
00058 //        case 16 :   Command = 0xb0; break;  // Make sure we support it
00059 //        default :   Command = 0xc0;
00060 //    }
00061 
00062     DPRINT("Initiating playback\n");
00063 
00064     // TEMPORARY:
00065     SB_WRITE_BYTE(BasePort, 0xc6);
00066     SB_WRITE_BYTE(BasePort, 0); // mode - TEMPORARY
00067     SB_WRITE_BYTE(BasePort, BlockSize % 256);
00068     SB_WRITE_BYTE(BasePort, BlockSize / 256);
00069 }

Generated on Sat May 26 2012 04:26:35 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.