aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/sfx/device
diff options
context:
space:
mode:
authorMax Horn2009-02-15 22:34:41 +0000
committerMax Horn2009-02-15 22:34:41 +0000
commit29611bc7ead4d3d5fc9df63c04dd9e2577805557 (patch)
tree42d26aab7ab2e7e97fe5b4763281d8071d878eed /engines/sci/sfx/device
parent921e6ff5cf3944c1a62a3ad9a91c29bb21aa9942 (diff)
downloadscummvm-rg350-29611bc7ead4d3d5fc9df63c04dd9e2577805557.tar.gz
scummvm-rg350-29611bc7ead4d3d5fc9df63c04dd9e2577805557.tar.bz2
scummvm-rg350-29611bc7ead4d3d5fc9df63c04dd9e2577805557.zip
SCI: Run astyle to make the code be more compliant with our Code Formatting Guidelines: sfx dir
svn-id: r38322
Diffstat (limited to 'engines/sci/sfx/device')
-rw-r--r--engines/sci/sfx/device/alsa-midi.cpp44
-rw-r--r--engines/sci/sfx/device/camd-midi.cpp26
-rw-r--r--engines/sci/sfx/device/devices.cpp18
-rw-r--r--engines/sci/sfx/device/unixraw-midi.cpp20
4 files changed, 43 insertions, 65 deletions
diff --git a/engines/sci/sfx/device/alsa-midi.cpp b/engines/sci/sfx/device/alsa-midi.cpp
index 67ca995916..8df0658d8b 100644
--- a/engines/sci/sfx/device/alsa-midi.cpp
+++ b/engines/sci/sfx/device/alsa-midi.cpp
@@ -44,19 +44,18 @@ static int subport_nr = 0;
static const char *seq_name = "default";
static void
-_set_tempo(void)
-{
+_set_tempo(void) {
int resolution = 60;
int tempo = 1;
snd_seq_queue_tempo_t *queue_tempo;
snd_seq_queue_tempo_malloc(&queue_tempo);
- memset(queue_tempo, 0, snd_seq_queue_tempo_sizeof());
- snd_seq_queue_tempo_set_ppq(queue_tempo, resolution);
- snd_seq_queue_tempo_set_tempo(queue_tempo, 1000000/tempo);
+ memset(queue_tempo, 0, snd_seq_queue_tempo_sizeof());
+ snd_seq_queue_tempo_set_ppq(queue_tempo, resolution);
+ snd_seq_queue_tempo_set_tempo(queue_tempo, 1000000 / tempo);
- snd_seq_set_queue_tempo(seq, queue, queue_tempo);
+ snd_seq_set_queue_tempo(seq, queue, queue_tempo);
snd_seq_queue_tempo_free(queue_tempo);
@@ -74,8 +73,7 @@ _set_tempo(void)
static int
-am_subscribe_to_ports(void)
-{
+am_subscribe_to_ports(void) {
if ((port_out = snd_seq_connect_to(seq, port_out, port_nr, subport_nr)) < 0) {
fprintf(stderr, "[SFX] Could not connect to ALSA sequencer port: %s\n", snd_strerror(port_out));
return SFX_ERROR;
@@ -85,8 +83,7 @@ am_subscribe_to_ports(void)
static int
-aminit(midi_writer_t *self)
-{
+aminit(midi_writer_t *self) {
int err;
snd_midi_event_new(4096, &parser);
@@ -96,15 +93,15 @@ aminit(midi_writer_t *self)
if (snd_seq_open(&seq, seq_name, SND_SEQ_OPEN_OUTPUT, SND_SEQ_NONBLOCK)) {
fprintf(stderr, "[SFX] Failed to open ALSA MIDI sequencer '%s' for output\n",
- seq_name);
+ seq_name);
return SFX_ERROR;
}
if ((port_out = snd_seq_create_simple_port(seq, "FreeSCI",
- SND_SEQ_PORT_CAP_WRITE |
- SND_SEQ_PORT_CAP_SUBS_WRITE |
- SND_SEQ_PORT_CAP_READ,
- SND_SEQ_PORT_TYPE_MIDI_GENERIC)) < 0) {
+ SND_SEQ_PORT_CAP_WRITE |
+ SND_SEQ_PORT_CAP_SUBS_WRITE |
+ SND_SEQ_PORT_CAP_READ,
+ SND_SEQ_PORT_TYPE_MIDI_GENERIC)) < 0) {
fprintf(stderr, "[SFX] Could not create ALSA sequencer port\n");
return SFX_ERROR;
}
@@ -120,7 +117,7 @@ aminit(midi_writer_t *self)
if ((err = snd_seq_drain_output(seq))) {
fflush(NULL);
fprintf(stderr, "[SFX] Error while draining: %s\n",
- snd_strerror(err));
+ snd_strerror(err));
return SFX_ERROR;
}
@@ -128,15 +125,13 @@ aminit(midi_writer_t *self)
}
static int
-amsetopt(midi_writer_t *self, char *name, char *value)
-{
+amsetopt(midi_writer_t *self, char *name, char *value) {
return SFX_ERROR;
}
static int
-amwrite(midi_writer_t *self, unsigned char *buf, int len)
-{
+amwrite(midi_writer_t *self, unsigned char *buf, int len) {
snd_seq_event_t evt;
#if 0
@@ -176,14 +171,12 @@ amwrite(midi_writer_t *self, unsigned char *buf, int len)
}
static void
-amdelay(midi_writer_t *self, int ticks)
-{
+amdelay(midi_writer_t *self, int ticks) {
delta += ticks;
}
static void
-amreset_timer(midi_writer_t *self)
-{
+amreset_timer(midi_writer_t *self) {
snd_seq_drain_output(seq);
snd_seq_stop_queue(seq, queue, NULL);
@@ -206,8 +199,7 @@ amreset_timer(midi_writer_t *self)
}
static void
-amclose(midi_writer_t *self)
-{
+amclose(midi_writer_t *self) {
snd_midi_event_free(parser);
parser = NULL;
}
diff --git a/engines/sci/sfx/device/camd-midi.cpp b/engines/sci/sfx/device/camd-midi.cpp
index 3af12f196e..8017b436d5 100644
--- a/engines/sci/sfx/device/camd-midi.cpp
+++ b/engines/sci/sfx/device/camd-midi.cpp
@@ -63,8 +63,7 @@ static struct MidiNode *midi_node = NULL;
}
static int
-camd_init(midi_writer_t *self)
-{
+camd_init(midi_writer_t *self) {
sciprintf("[SFX] Initialising CAMD raw MIDI backend, v%s\n", SCI_CAMD_MIDI_VERSION);
CamdBase = IExec->OpenLibrary("camd.library", 36L);
@@ -72,8 +71,8 @@ camd_init(midi_writer_t *self)
ABORT("Could not open 'camd.library'");
ICamd = (struct CamdIFace *) IExec->GetInterface(CamdBase, "main", 1, NULL);
- if (!ICamd)
- ABORT("Error while retrieving CAMD interface\n");
+ if (!ICamd)
+ ABORT("Error while retrieving CAMD interface\n");
midi_node = ICamd->CreateMidi(MIDI_MsgQueue, 0L, MIDI_SysExSize, 4096L, MIDI_Name, "freesci", TAG_END);
if (!midi_node)
@@ -89,16 +88,14 @@ camd_init(midi_writer_t *self)
}
static int
-camd_set_option(midi_writer_t *self, char *name, char *value)
-{
+camd_set_option(midi_writer_t *self, char *name, char *value) {
return SFX_ERROR;
}
#define MAX_MIDI_LEN 3
static int
-camd_write(midi_writer_t *self, unsigned char *buffer, int len)
-{
+camd_write(midi_writer_t *self, unsigned char *buffer, int len) {
if (len == 0)
return SFX_OK;
@@ -119,7 +116,7 @@ camd_write(midi_writer_t *self, unsigned char *buffer, int len)
if (len > MAX_MIDI_LEN)
sciprintf("[SFX] Warning: Truncated MIDI message to fit CAMD format (sent %d: %02x %02x %02x, real length %d)\n",
- MAX_MIDI_LEN, buffer[0], buffer[1], buffer[2], len);
+ MAX_MIDI_LEN, buffer[0], buffer[1], buffer[2], len);
ICamd->PutMidi(midi_link, data);
}
@@ -128,21 +125,18 @@ camd_write(midi_writer_t *self, unsigned char *buffer, int len)
}
static void
-camd_delay(midi_writer_t *self, int ticks)
-{
+camd_delay(midi_writer_t *self, int ticks) {
}
static void
-camd_reset_timer(midi_writer_t *self)
-{
+camd_reset_timer(midi_writer_t *self) {
}
static void
-camd_close(midi_writer_t *self)
-{
+camd_close(midi_writer_t *self) {
#ifdef NO_OP
return;
-#endif
+#endif
if (CamdBase)
IExec->CloseLibrary(CamdBase);
}
diff --git a/engines/sci/sfx/device/devices.cpp b/engines/sci/sfx/device/devices.cpp
index f51c928d7e..6a89ee5df6 100644
--- a/engines/sci/sfx/device/devices.cpp
+++ b/engines/sci/sfx/device/devices.cpp
@@ -49,16 +49,16 @@ extern struct _midi_device sfx_device_midi_camd;
static struct _midi_device *devices_midi[] = {
#ifndef SCUMMVM
#ifdef HAVE_PROTO_CAMD_H
- &sfx_device_midi_camd,
+ &sfx_device_midi_camd,
#endif
#ifdef HAVE_ALSA
- &sfx_device_midi_alsa,
+ &sfx_device_midi_alsa,
#endif
#ifdef UNIX
- &sfx_device_midi_unixraw,
+ &sfx_device_midi_unixraw,
#endif
#endif // SCUMMVM
- NULL
+ NULL
};
static struct _midi_device *devices_opl2[] = {
@@ -76,8 +76,7 @@ struct _midi_device **devices[] = {
static struct _midi_device *
-find_dev(int type, char *name)
-{
+ find_dev(int type, char *name) {
int i = 0;
if (!type)
@@ -94,19 +93,18 @@ find_dev(int type, char *name)
void *
-sfx_find_device(int type, char *name)
-{
+sfx_find_device(int type, char *name) {
struct _midi_device *dev = find_dev(type, name);
if (dev) {
if (dev->init(dev)) {
fprintf(stderr, "[SFX] Opening device '%s' failed\n",
- dev->name);
+ dev->name);
return NULL;
}
return dev;
};
-
+
return NULL;
}
diff --git a/engines/sci/sfx/device/unixraw-midi.cpp b/engines/sci/sfx/device/unixraw-midi.cpp
index 69ce3890fc..0d9e92b20b 100644
--- a/engines/sci/sfx/device/unixraw-midi.cpp
+++ b/engines/sci/sfx/device/unixraw-midi.cpp
@@ -42,11 +42,10 @@ static int fd;
static const char *devicename = "/dev/midi";
static int
-unixraw_init(midi_writer_t *self)
-{
+unixraw_init(midi_writer_t *self) {
sciprintf("[SFX] Initialising UNIX raw MIDI backend, v%s\n", SCI_UNIXRAW_MIDI_VERSION);
- fd = open(devicename, O_WRONLY|O_SYNC);
+ fd = open(devicename, O_WRONLY | O_SYNC);
if (!IS_VALID_FD(fd)) {
sciprintf("[SFX] Failed to open %s\n", devicename);
@@ -57,14 +56,12 @@ unixraw_init(midi_writer_t *self)
}
static int
-unixraw_set_option(midi_writer_t *self, char *name, char *value)
-{
+unixraw_set_option(midi_writer_t *self, char *name, char *value) {
return SFX_ERROR;
}
static int
-unixraw_write(midi_writer_t *self, unsigned char *buffer, int len)
-{
+unixraw_write(midi_writer_t *self, unsigned char *buffer, int len) {
if (write(fd, buffer, len) != len) {
sciprintf("[SFX] MIDI write error\n");
return SFX_ERROR;
@@ -73,18 +70,15 @@ unixraw_write(midi_writer_t *self, unsigned char *buffer, int len)
}
static void
-unixraw_delay(midi_writer_t *self, int ticks)
-{
+unixraw_delay(midi_writer_t *self, int ticks) {
}
static void
-unixraw_reset_timer(midi_writer_t *self)
-{
+unixraw_reset_timer(midi_writer_t *self) {
}
static void
-unixraw_close(midi_writer_t *self)
-{
+unixraw_close(midi_writer_t *self) {
close(fd);
}