mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-12-26 08:32:20 +00:00
Unix: new prefs options "dsp" and "mixer" to set the OSS device names instead
of the hardcoded '/dev/dsp' and '/dev/mixer'
This commit is contained in:
parent
2cb7e02c9e
commit
466fc971f6
@ -5,13 +5,15 @@ V1.0 (snapshot) - <date>
|
|||||||
- Unix: add large file support for 2+ GB hard disk images
|
- Unix: add large file support for 2+ GB hard disk images
|
||||||
- Unix: cleaned up pthread attributes [Brian Johnson]
|
- Unix: cleaned up pthread attributes [Brian Johnson]
|
||||||
- Unix: fixed floppy problems under Linux
|
- Unix: fixed floppy problems under Linux
|
||||||
- Unix: implement "ignoresegv" feature on Linux/x86, Linux/ppc, Darwin/ppc
|
- Unix: implemented "ignoresegv" feature on Linux/x86, Linux/ppc, Darwin/ppc
|
||||||
- Unix: serial port baud rates are now set correctly
|
- Unix: serial port baud rates are now set correctly
|
||||||
- Unix: it is now possible to make the serial drivers pipe their input/output
|
- Unix: it is now possible to make the serial drivers pipe their input/output
|
||||||
to programs by using a '|' followed by a command line as the modem or
|
to programs by using a '|' followed by a command line as the modem or
|
||||||
printer port setting (instead of a device name like '/dev/ttyS0')
|
printer port setting (instead of a device name like '/dev/ttyS0')
|
||||||
[Brian Johnson]
|
[Brian Johnson]
|
||||||
- Unix: the option "--config FILE" tells B2 to use a different config file
|
- Unix: the option "--config FILE" tells B2 to use a different config file
|
||||||
|
- Unix: new prefs options "dsp" and "mixer" to set the OSS device names
|
||||||
|
instead of the hardcoded '/dev/dsp' and '/dev/mixer'
|
||||||
|
|
||||||
V1.0 (snapshot) - 15.Jan.2002
|
V1.0 (snapshot) - 15.Jan.2002
|
||||||
- added support for on-the-fly video resolution and depth switching, and
|
- added support for on-the-fly video resolution and depth switching, and
|
||||||
|
@ -285,7 +285,6 @@ screen <video mode>
|
|||||||
application via Alt-Tab, Basilisk II is put in "snooze" mode (i.e. MacOS
|
application via Alt-Tab, Basilisk II is put in "snooze" mode (i.e. MacOS
|
||||||
is frozen).
|
is frozen).
|
||||||
|
|
||||||
|
|
||||||
Mac OS X:
|
Mac OS X:
|
||||||
The "video mode" is one of the following:
|
The "video mode" is one of the following:
|
||||||
win/<width>/<height>
|
win/<width>/<height>
|
||||||
@ -302,7 +301,6 @@ screen <video mode>
|
|||||||
opengl/<width>/<height>/<bits per pixel>
|
opengl/<width>/<height>/<bits per pixel>
|
||||||
Currently unimplemented, will be a fast windowed mode.
|
Currently unimplemented, will be a fast windowed mode.
|
||||||
|
|
||||||
|
|
||||||
seriala <serial port description>
|
seriala <serial port description>
|
||||||
|
|
||||||
This item describes the serial port to be used as Port A (Modem Port)
|
This item describes the serial port to be used as Port A (Modem Port)
|
||||||
@ -580,6 +578,13 @@ Unix:
|
|||||||
is "false". This feature is only implemented on the following
|
is "false". This feature is only implemented on the following
|
||||||
platforms: Linux/x86, Linux/ppc, Darwin/ppc.
|
platforms: Linux/x86, Linux/ppc, Darwin/ppc.
|
||||||
|
|
||||||
|
dsp <device name>
|
||||||
|
mixer <device name>
|
||||||
|
|
||||||
|
Under Linux and FreeBSD, this specifies the devices to be used for sound
|
||||||
|
output and volume control, respectively. The defaults are "/dev/dsp" and
|
||||||
|
"/dev/mixer".
|
||||||
|
|
||||||
AmigaOS:
|
AmigaOS:
|
||||||
|
|
||||||
sound <sound output description>
|
sound <sound output description>
|
||||||
|
@ -28,7 +28,6 @@ AmigaOS:
|
|||||||
- Input handler instead of IDCMP?
|
- Input handler instead of IDCMP?
|
||||||
- Last sound buffer is not played
|
- Last sound buffer is not played
|
||||||
- Sound output rate/bits/channels switching
|
- Sound output rate/bits/channels switching
|
||||||
- Video depth/resolution switching
|
|
||||||
|
|
||||||
BeOS:
|
BeOS:
|
||||||
- clip_beos.cpp: clip BeOS->Basilisk
|
- clip_beos.cpp: clip BeOS->Basilisk
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
#ifdef __FreeBSD__
|
||||||
#include <sys/soundcard.h>
|
#include <machine/soundcard.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "cpu_emulation.h"
|
#include "cpu_emulation.h"
|
||||||
@ -54,12 +54,9 @@ static int audio_sample_rate_index = 0;
|
|||||||
static int audio_sample_size_index = 0;
|
static int audio_sample_size_index = 0;
|
||||||
static int audio_channel_count_index = 0;
|
static int audio_channel_count_index = 0;
|
||||||
|
|
||||||
// Constants
|
|
||||||
#define DSP_NAME "/dev/dsp"
|
|
||||||
|
|
||||||
// Global variables
|
// Global variables
|
||||||
static int audio_fd = -1; // fd of /dev/dsp or ESD
|
static int audio_fd = -1; // fd of dsp or ESD
|
||||||
static int mixer_fd = -1; // fd of /dev/mixer
|
static int mixer_fd = -1; // fd of mixer
|
||||||
static sem_t audio_irq_done_sem; // Signal from interrupt to streaming thread: data block read
|
static sem_t audio_irq_done_sem; // Signal from interrupt to streaming thread: data block read
|
||||||
static bool sem_inited = false; // Flag: audio_irq_done_sem initialized
|
static bool sem_inited = false; // Flag: audio_irq_done_sem initialized
|
||||||
static int sound_buffer_size; // Size of sound buffer in bytes
|
static int sound_buffer_size; // Size of sound buffer in bytes
|
||||||
@ -86,17 +83,18 @@ static void set_audio_status_format(void)
|
|||||||
AudioStatus.channels = audio_channel_counts[audio_channel_count_index];
|
AudioStatus.channels = audio_channel_counts[audio_channel_count_index];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init using /dev/dsp, returns false on error
|
// Init using the dsp device, returns false on error
|
||||||
static bool open_dsp(void)
|
static bool open_dsp(void)
|
||||||
{
|
{
|
||||||
// Open /dev/dsp
|
// Open the device
|
||||||
audio_fd = open(DSP_NAME, O_WRONLY);
|
const char *dsp = PrefsFindString("dsp");
|
||||||
|
audio_fd = open(dsp, O_WRONLY);
|
||||||
if (audio_fd < 0) {
|
if (audio_fd < 0) {
|
||||||
fprintf(stderr, "WARNING: Cannot open %s (%s)\n", DSP_NAME, strerror(errno));
|
fprintf(stderr, "WARNING: Cannot open %s (%s)\n", dsp, strerror(errno));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Using " DSP_NAME " audio output\n");
|
printf("Using %s audio output\n", dsp);
|
||||||
|
|
||||||
// Get supported sample formats
|
// Get supported sample formats
|
||||||
if (audio_sample_sizes.empty()) {
|
if (audio_sample_sizes.empty()) {
|
||||||
@ -213,7 +211,7 @@ static bool open_esd(void)
|
|||||||
|
|
||||||
// The reason we do this here is that we don't want to add sample
|
// The reason we do this here is that we don't want to add sample
|
||||||
// rates etc. unless the ESD server connection could be opened
|
// rates etc. unless the ESD server connection could be opened
|
||||||
// (if ESD fails, /dev/dsp might be tried next)
|
// (if ESD fails, dsp might be tried next)
|
||||||
audio_sample_rates.push_back(11025 << 16);
|
audio_sample_rates.push_back(11025 << 16);
|
||||||
audio_sample_rates.push_back(22050 << 16);
|
audio_sample_rates.push_back(22050 << 16);
|
||||||
audio_sample_rates.push_back(44100 << 16);
|
audio_sample_rates.push_back(44100 << 16);
|
||||||
@ -246,12 +244,12 @@ static bool open_audio(void)
|
|||||||
goto dev_opened;
|
goto dev_opened;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Try to open /dev/dsp
|
// Try to open dsp
|
||||||
if (open_dsp())
|
if (open_dsp())
|
||||||
goto dev_opened;
|
goto dev_opened;
|
||||||
|
|
||||||
#ifdef ENABLE_ESD
|
#ifdef ENABLE_ESD
|
||||||
// Hm, /dev/dsp failed so we try ESD again if ESPEAKER wasn't set
|
// Hm, dsp failed so we try ESD again if ESPEAKER wasn't set
|
||||||
if (!getenv("ESPEAKER"))
|
if (!getenv("ESPEAKER"))
|
||||||
if (open_esd())
|
if (open_esd())
|
||||||
goto dev_opened;
|
goto dev_opened;
|
||||||
@ -294,10 +292,11 @@ void AudioInit(void)
|
|||||||
return;
|
return;
|
||||||
sem_inited = true;
|
sem_inited = true;
|
||||||
|
|
||||||
// Try to open /dev/mixer
|
// Try to open the mixer device
|
||||||
mixer_fd = open("/dev/mixer", O_RDWR);
|
const char *mixer = PrefsFindString("mixer");
|
||||||
|
mixer_fd = open(mixer, O_RDWR);
|
||||||
if (mixer_fd < 0)
|
if (mixer_fd < 0)
|
||||||
printf("WARNING: Cannot open /dev/mixer (%s)", strerror(errno));
|
printf("WARNING: Cannot open %s (%s)\n", mixer, strerror(errno));
|
||||||
|
|
||||||
// Open and initialize audio device
|
// Open and initialize audio device
|
||||||
open_audio();
|
open_audio();
|
||||||
@ -320,7 +319,7 @@ static void close_audio(void)
|
|||||||
stream_thread_active = false;
|
stream_thread_active = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close /dev/dsp or ESD socket
|
// Close dsp or ESD socket
|
||||||
if (audio_fd >= 0) {
|
if (audio_fd >= 0) {
|
||||||
close(audio_fd);
|
close(audio_fd);
|
||||||
audio_fd = -1;
|
audio_fd = -1;
|
||||||
@ -340,7 +339,7 @@ void AudioExit(void)
|
|||||||
sem_inited = false;
|
sem_inited = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close /dev/mixer
|
// Close mixer device
|
||||||
if (mixer_fd >= 0) {
|
if (mixer_fd >= 0) {
|
||||||
close(mixer_fd);
|
close(mixer_fd);
|
||||||
mixer_fd = -1;
|
mixer_fd = -1;
|
||||||
|
@ -715,6 +715,8 @@ static GtkWidget *l_fbdev_name, *l_fbdevice_file;
|
|||||||
static char fbdev_name[256];
|
static char fbdev_name[256];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static GtkWidget *w_dspdevice_file, *w_mixerdevice_file;
|
||||||
|
|
||||||
// Hide/show graphics widgets
|
// Hide/show graphics widgets
|
||||||
static void hide_show_graphics_widgets(void)
|
static void hide_show_graphics_widgets(void)
|
||||||
{
|
{
|
||||||
@ -761,10 +763,19 @@ static void mn_30hz(...) {PrefsReplaceInt32("frameskip", 2);}
|
|||||||
static void mn_60hz(...) {PrefsReplaceInt32("frameskip", 1);}
|
static void mn_60hz(...) {PrefsReplaceInt32("frameskip", 1);}
|
||||||
static void mn_dynamic(...) {PrefsReplaceInt32("frameskip", 0);}
|
static void mn_dynamic(...) {PrefsReplaceInt32("frameskip", 0);}
|
||||||
|
|
||||||
|
// Set sensitivity of widgets
|
||||||
|
static void set_graphics_sensitive(void)
|
||||||
|
{
|
||||||
|
const bool sound_enabled = !PrefsFindBool("nosound");
|
||||||
|
gtk_widget_set_sensitive(w_dspdevice_file, sound_enabled);
|
||||||
|
gtk_widget_set_sensitive(w_mixerdevice_file, sound_enabled);
|
||||||
|
}
|
||||||
|
|
||||||
// "Disable Sound Output" button toggled
|
// "Disable Sound Output" button toggled
|
||||||
static void tb_nosound(GtkWidget *widget)
|
static void tb_nosound(GtkWidget *widget)
|
||||||
{
|
{
|
||||||
PrefsReplaceBool("nosound", GTK_TOGGLE_BUTTON(widget)->active);
|
PrefsReplaceBool("nosound", GTK_TOGGLE_BUTTON(widget)->active);
|
||||||
|
set_graphics_sensitive();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read graphics preferences
|
// Read graphics preferences
|
||||||
@ -827,6 +838,8 @@ static void read_graphics_settings(void)
|
|||||||
else
|
else
|
||||||
PrefsRemoveItem("fbdevicefile");
|
PrefsRemoveItem("fbdevicefile");
|
||||||
#endif
|
#endif
|
||||||
|
PrefsReplaceString("dsp", get_file_entry_path(w_dspdevice_file));
|
||||||
|
PrefsReplaceString("mixer", get_file_entry_path(w_mixerdevice_file));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create "Graphics/Sound" pane
|
// Create "Graphics/Sound" pane
|
||||||
@ -947,6 +960,10 @@ static void create_graphics_pane(GtkWidget *top)
|
|||||||
|
|
||||||
make_separator(box);
|
make_separator(box);
|
||||||
make_checkbox(box, STR_NOSOUND_CTRL, "nosound", GTK_SIGNAL_FUNC(tb_nosound));
|
make_checkbox(box, STR_NOSOUND_CTRL, "nosound", GTK_SIGNAL_FUNC(tb_nosound));
|
||||||
|
w_dspdevice_file = make_file_entry(box, STR_DSPDEVICE_FILE_CTRL, "dsp");
|
||||||
|
w_mixerdevice_file = make_file_entry(box, STR_MIXERDEVICE_FILE_CTRL, "mixer");
|
||||||
|
|
||||||
|
set_graphics_sensitive();
|
||||||
|
|
||||||
hide_show_graphics_widgets();
|
hide_show_graphics_widgets();
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,8 @@ prefs_desc platform_prefs_items[] = {
|
|||||||
{"fbdevicefile", TYPE_STRING, false, "path of frame buffer device specification file"},
|
{"fbdevicefile", TYPE_STRING, false, "path of frame buffer device specification file"},
|
||||||
{"mousewheelmode", TYPE_INT32, false, "mouse wheel support mode (0=page up/down, 1=cursor up/down)"},
|
{"mousewheelmode", TYPE_INT32, false, "mouse wheel support mode (0=page up/down, 1=cursor up/down)"},
|
||||||
{"mousewheellines", TYPE_INT32, false, "number of lines to scroll in mouse wheel mode 1"},
|
{"mousewheellines", TYPE_INT32, false, "number of lines to scroll in mouse wheel mode 1"},
|
||||||
|
{"dsp", TYPE_STRING, false, "audio output (dsp) device name"},
|
||||||
|
{"mixer", TYPE_STRING, false, "audio mixer device name"},
|
||||||
#ifdef HAVE_SIGSEGV_SKIP_INSTRUCTION
|
#ifdef HAVE_SIGSEGV_SKIP_INSTRUCTION
|
||||||
{"ignoresegv", TYPE_BOOLEAN, false, "ignore illegal memory accesses"},
|
{"ignoresegv", TYPE_BOOLEAN, false, "ignore illegal memory accesses"},
|
||||||
#endif
|
#endif
|
||||||
@ -105,6 +107,18 @@ void AddPlatformPrefsDefaults(void)
|
|||||||
PrefsReplaceString("extfs", "/");
|
PrefsReplaceString("extfs", "/");
|
||||||
PrefsReplaceInt32("mousewheelmode", 1);
|
PrefsReplaceInt32("mousewheelmode", 1);
|
||||||
PrefsReplaceInt32("mousewheellines", 3);
|
PrefsReplaceInt32("mousewheellines", 3);
|
||||||
|
#ifdef __linux__
|
||||||
|
if (access("/dev/.devfsd", F_OK) < 0) {
|
||||||
|
PrefsReplaceString("dsp", "/dev/dsp");
|
||||||
|
PrefsReplaceString("mixer", "/dev/mixer");
|
||||||
|
} else {
|
||||||
|
PrefsReplaceString("dsp", "/dev/sound/dsp");
|
||||||
|
PrefsReplaceString("mixer", "/dev/sound/mixer");
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
PrefsReplaceString("dsp", "/dev/dsp");
|
||||||
|
PrefsReplaceString("mixer", "/dev/mixer");
|
||||||
|
#endif
|
||||||
#ifdef HAVE_SIGSEGV_SKIP_INSTRUCTION
|
#ifdef HAVE_SIGSEGV_SKIP_INSTRUCTION
|
||||||
PrefsAddBool("ignoresegv", false);
|
PrefsAddBool("ignoresegv", false);
|
||||||
#endif
|
#endif
|
||||||
|
@ -66,6 +66,8 @@ user_string_def platform_strings[] = {
|
|||||||
|
|
||||||
{STR_FBDEV_NAME_CTRL, "Frame Buffer Name"},
|
{STR_FBDEV_NAME_CTRL, "Frame Buffer Name"},
|
||||||
{STR_FBDEVICE_FILE_CTRL, "Frame Buffer Spec File"},
|
{STR_FBDEVICE_FILE_CTRL, "Frame Buffer Spec File"},
|
||||||
|
{STR_DSPDEVICE_FILE_CTRL, "Audio Output Device"},
|
||||||
|
{STR_MIXERDEVICE_FILE_CTRL, "Audio Mixer Device"},
|
||||||
|
|
||||||
{STR_INPUT_PANE_TITLE, "Mouse/Keyboard"},
|
{STR_INPUT_PANE_TITLE, "Mouse/Keyboard"},
|
||||||
{STR_KEYCODES_CTRL, "Use Raw Keycodes"},
|
{STR_KEYCODES_CTRL, "Use Raw Keycodes"},
|
||||||
|
@ -57,6 +57,8 @@ enum {
|
|||||||
|
|
||||||
STR_FBDEV_NAME_CTRL,
|
STR_FBDEV_NAME_CTRL,
|
||||||
STR_FBDEVICE_FILE_CTRL,
|
STR_FBDEVICE_FILE_CTRL,
|
||||||
|
STR_DSPDEVICE_FILE_CTRL,
|
||||||
|
STR_MIXERDEVICE_FILE_CTRL,
|
||||||
|
|
||||||
STR_INPUT_PANE_TITLE,
|
STR_INPUT_PANE_TITLE,
|
||||||
STR_KEYCODES_CTRL,
|
STR_KEYCODES_CTRL,
|
||||||
|
Loading…
Reference in New Issue
Block a user