You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

583 lines
9.6 KiB

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>Using sound</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REL="HOME"
TITLE="Bochs User Manual"
HREF="index.html"><LINK
REL="UP"
TITLE="Using Bochs"
HREF="using-bochs.html"><LINK
REL="PREVIOUS"
TITLE="Save and restore simulation"
HREF="using-save-restore.html"><LINK
REL="NEXT"
TITLE="Common problems and what to do about them (Troubleshooting)"
HREF="common-problems.html"></HEAD
><BODY
CLASS="SECTION"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Bochs User Manual</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="using-save-restore.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 5. Using Bochs</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="common-problems.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECTION"
><H1
CLASS="SECTION"
><A
NAME="USING-SOUND"
>5.6. Using sound</A
></H1
><DIV
CLASS="SECTION"
><H2
CLASS="SECTION"
><A
NAME="AEN3137"
>5.6.1. Sound basics</A
></H2
><P
>Bochs supports two types of soundcards (SB16 ISA and ES1370 PCI) and the legacy
PC speaker. The lowlevel sound interface provides a set of functions for wave
(PCM) input / output and MIDI output using the host sound system. A driver must
not implement all of these functions. The following table shows the supported
drivers and their features.
<DIV
CLASS="TABLE"
><A
NAME="AEN3140"
></A
><P
><B
>Table 5-3. Sound lowlevel modules</B
></P
><TABLE
BORDER="1"
RULES="all"
CLASS="CALSTABLE"
><COL><COL><COL><COL><THEAD
><TR
><TH
>Name</TH
><TH
>Description</TH
><TH
>Wave input</TH
><TH
>MIDI output</TH
></TR
></THEAD
><TBODY
><TR
><TD
>alsa</TD
><TD
>use the default ALSA PCM device and the default ALSA sequencer
on Linux</TD
><TD
>Yes</TD
><TD
>Yes</TD
></TR
><TR
><TD
>oss</TD
><TD
>use the Open Sound System on Linux and FreeBSD</TD
><TD
>Yes</TD
><TD
>Yes</TD
></TR
><TR
><TD
>osx</TD
><TD
>for output on Mac OS 9 and Mac OSX</TD
><TD
>No</TD
><TD
>Yes</TD
></TR
><TR
><TD
>sdl</TD
><TD
>for wave output on platforms supported by SDL (1.2.x or 2.x)</TD
><TD
>No</TD
><TD
>No</TD
></TR
><TR
><TD
>win</TD
><TD
>for output to the midi and wave mapper of Windows</TD
><TD
>Yes</TD
><TD
>Yes</TD
></TR
></TBODY
></TABLE
></DIV
></P
><P
>These special values are also valid for the sound driver:
<P
></P
><UL
><LI
><P
><CODE
CLASS="OPTION"
>default</CODE
> - select platform-default sound driver.</P
></LI
><LI
><P
><CODE
CLASS="OPTION"
>file</CODE
> - wave and MIDI output to file(s)</P
></LI
><LI
><P
><CODE
CLASS="OPTION"
>dummy</CODE
> - no output at all</P
></LI
></UL
></P
><P
>When compiling Bochs, the lowlevel sound support is activated if one of the soundcards
is enabled (<CODE
CLASS="OPTION"
>--enable-sb16</CODE
> or <CODE
CLASS="OPTION"
>--enable-es1370</CODE
>).
The configure script detects the available drivers and sets up a platform-default
one.</P
><P
>At runtime the lowlevel sound module will be loaded automatically if one of the
sound devices is enabled in the <TT
CLASS="FILENAME"
>bochsrc</TT
>. The drivers and
devices for wave input / output and MIDI output must be set up with the
<A
HREF="bochsrc.html#BOCHSOPT-SOUND"
>sound</A
> option.</P
></DIV
><DIV
CLASS="SECTION"
><H2
CLASS="SECTION"
><A
NAME="AEN3192"
>5.6.2. The PC speaker</A
></H2
><P
>The PC speaker is connected to the PIT 8254 timer #2 and generates a square
wave beep with a frequency depending on the timer value. In Bochs the
speaker is a separate plugin that is controlled by the two events "beep on"
and "beep off". The "beep on" event is also called when the frequency
changes while turned on.</P
><P
>The destination for the speaker output can be selected with the <CODE
CLASS="OPTION"
>mode</CODE
>
parameter of the <A
HREF="bochsrc.html#BOCHSOPT-SPEAKER"
>speaker</A
> option. Three choices are available:
<P
></P
><UL
><LI
><P
><CODE
CLASS="OPTION"
>sound</CODE
> : the beep is generated by the square wave
generator which is a part of the lowlevel sound support.</P
></LI
><LI
><P
><CODE
CLASS="OPTION"
>system</CODE
> : only available on Linux and Windows.
On Linux /dev/console is used for output and on Windows the Beep() function.</P
></LI
><LI
><P
><CODE
CLASS="OPTION"
>gui</CODE
> : forwards the beep to the related gui methods
(currently only used by the Carbon gui).</P
></LI
></UL
></P
></DIV
><DIV
CLASS="SECTION"
><H2
CLASS="SECTION"
><A
NAME="AEN3208"
>5.6.3. SB16 runtime configuration</A
></H2
><P
>Most of the SB16 configuration parameters are available in the runtime
configuration menu or dialog. In addition to this, there is a small program
called <B
CLASS="COMMAND"
>SB16CTRL</B
> to change emulation settings from inside
the simulation.</P
><DIV
CLASS="SECTION"
><H3
CLASS="SECTION"
><A
NAME="AEN3212"
>5.6.3.1. Runtime options</A
></H3
><P
>Unlike other devices, the SB16 emulation has it's own logfile and a loglevel parameter
to control what should be printed there. Both the <CODE
CLASS="OPTION"
>log</CODE
> file and
<CODE
CLASS="OPTION"
>loglevel</CODE
> parameters can be changed at runtime. See the
<A
HREF="bochsrc.html#BOCHSOPT-SB16"
>sb16</A
> bochsrc option for details.</P
><P
>The output parameters <CODE
CLASS="OPTION"
>midimode</CODE
>, <CODE
CLASS="OPTION"
>midifile</CODE
>,
<CODE
CLASS="OPTION"
>wavemode</CODE
> and <CODE
CLASS="OPTION"
>wavefile</CODE
> are also available at
runtime.</P
><P
>The <CODE
CLASS="OPTION"
>dmatimer</CODE
> parameter controls the DMA timing for wave (PCM)
input and output. When you get non-continuous sound this value can be ajusted
to fix this. This needs a reasonably correct setting for the
<A
HREF="bochsrc.html#BOCHSOPT-CPU-IPS"
>cpu: ips</A
> option.</P
></DIV
><DIV
CLASS="SECTION"
><H3
CLASS="SECTION"
><A
NAME="SB16CTRL"
>5.6.3.2. SB16CTRL</A
></H3
><P
>The source for the SB16CTRL program that is used to modify
the runtime behavior of the SB16 emulation is included in
<TT
CLASS="FILENAME"
>misc/sb16/</TT
>. It is a C
program that can be run from inside the emulation.</P
><P
>It currently supports the following commands:</P
><DIV
CLASS="TABLE"
><A
NAME="AEN3231"
></A
><P
><B
>Table 5-4. Supported options for <B
CLASS="COMMAND"
>sb16ctrl</B
></B
></P
><TABLE
BORDER="1"
CLASS="CALSTABLE"
><COL><COL><THEAD
><TR
><TH
>Option</TH
><TH
>Description</TH
></TR
></THEAD
><TBODY
><TR
><TD
><CODE
CLASS="OPTION"
>-i <TT
CLASS="REPLACEABLE"
><I
>number</I
></TT
></CODE
></TD
><TD
> Show the selected emulator info string,
e.g. <B
CLASS="COMMAND"
>sb16ctrl -i 3</B
> to show how many patch translations are active.
</TD
></TR
><TR
><TD
><CODE
CLASS="OPTION"
>-t <TT
CLASS="REPLACEABLE"
><I
>six numbers</I
></TT
></CODE
></TD
><TD
> Load a translation into the translation table. The numbers are:
"OldBankMSB,OldBankLSB,OldProgram,NewBankMSB,NewBankLSB,NewProgram".
All values can be 0..127 or 255. 255 for "Old" values means <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>match
any</I
></SPAN
> and for "New" values means <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>don't change</I
></SPAN
>,
e.g. <B
CLASS="COMMAND"
>sb16ctrl -t 255,255,0,255,255,32</B
>
to change patch 0 (Piano) to patch 32 (Acoustic Bass).
</TD
></TR
><TR
><TD
><CODE
CLASS="OPTION"
>-r</CODE
></TD
><TD
> Reset the patch translation table e.g. <B
CLASS="COMMAND"
>sb16ctrl -r</B
>.
</TD
></TR
><TR
><TD
><CODE
CLASS="OPTION"
>-m <TT
CLASS="REPLACEABLE"
><I
>some numbers</I
></TT
></CODE
></TD
><TD
> Upload the given numbers to the midi output device. Note
that it should be a complete midi message, and also that it is
subject to patch translation,
e.g. <B
CLASS="COMMAND"
>sb16ctrl -m 0x80,64,0</B
>
to send a note-off message to channel 0.
</TD
></TR
><TR
><TD
><CODE
CLASS="OPTION"
>-f <TT
CLASS="REPLACEABLE"
><I
>filename</I
></TT
></CODE
></TD
><TD
> Read in a file and execute the commands in it. These have
the same format as the above commands, except that they don't have
the dash "-" in front of them.
Comment lines are supported and start with a hash sign "#".
</TD
></TR
><TR
><TD
><CODE
CLASS="OPTION"
>-h</CODE
></TD
><TD
> Show a brief summary of the commands.
</TD
></TR
></TBODY
></TABLE
></DIV
><P
>All numbers can be valid parameters to the <CODE
CLASS="FUNCTION"
>strtol()</CODE
> function, so hex and
octal notation is fine. They have to be delimited by either commas "," or
slashes "/", spaces are not allowed.</P
><P
>The command line can have any number of commands. However, if none are given,
"-f -" is assumed, which means commands are taken from stdin.</P
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="using-save-restore.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="common-problems.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Save and restore simulation</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="using-bochs.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Common problems and what to do about them (Troubleshooting)</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>