File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ /* KallistiOS ##version##
2+
3+ dc/sound/midi.h
4+ Copyright (C) 2020 Thomas Sowell
5+
6+ */
7+
8+ /** \file dc/sound/midi.h
9+ \brief MIDI support.
10+
11+ \author Thomas Sowell
12+ */
13+
14+ #ifndef __DC_SOUND_MIDI_H
15+ #define __DC_SOUND_MIDI_H
16+
17+ #include <sys/cdefs.h>
18+
19+ __BEGIN_DECLS
20+
21+ void snd_midi (uint8 midi );
22+
23+ __END_DECLS
24+
25+ #endif /* __DC_SOUND_MIDI_H */
Original file line number Diff line number Diff line change 44# (c)2001 Dan Potter
55#
66
7- OBJS = snd_iface.o snd_sfxmgr.o snd_stream.o snd_stream_drv.o snd_mem.o
7+ OBJS = snd_iface.o snd_sfxmgr.o snd_stream.o snd_stream_drv.o snd_mem.o snd_midi.o
88
99# Only compile this if we have an ARM compiler handy
1010ifdef DC_ARM_CC
Original file line number Diff line number Diff line change @@ -67,11 +67,18 @@ typedef struct aica_channel {
6767 aica_channel_t * CHANR = (aica_channel_t *)(CMDR->cmd_data);
6868#define AICA_CMDSTR_CHANNEL_SIZE ((sizeof(aica_cmd_t) + sizeof(aica_channel_t))/4)
6969
70+ #define AICA_CMDSTR_MIDI (T , CMDR , MIDIR ) \
71+ uint8 T[sizeof(aica_cmd_t) + sizeof(uint32)]; \
72+ aica_cmd_t * CMDR = (aica_cmd_t *)T; \
73+ uint32 * MIDIR = (uint32 *)(CMDR->cmd_data);
74+ #define AICA_CMDSTR_MIDI_SIZE ((sizeof(aica_cmd_t) + sizeof(uint32))/4)
75+
7076/* Command values (for aica_cmd_t) */
7177#define AICA_CMD_NONE 0x00000000 /* No command (dummy packet) */
7278#define AICA_CMD_PING 0x00000001 /* Check for signs of life */
7379#define AICA_CMD_CHAN 0x00000002 /* Perform a wavetable action */
7480#define AICA_CMD_SYNC_CLOCK 0x00000003 /* Reset the millisecond clock */
81+ #define AICA_CMD_MIDI 0x00000004
7582
7683/* Response values (for aica_cmd_t) */
7784#define AICA_RESP_NONE 0x00000000
Original file line number Diff line number Diff line change @@ -127,6 +127,10 @@ uint32 process_one(uint32 tail) {
127127 /* Reset our timer clock to zero */
128128 timer = 0 ;
129129 break ;
130+ case AICA_CMD_MIDI :
131+ while ((SNDREG32 (0x2808 ) & 0x1000 ) == 0x1000 );
132+ SNDREG32 (0x280C ) = ((uint32 * )pkt -> cmd_data )[0 ] & 0x000000FF ;
133+ break ;
130134 default :
131135 /* error */
132136 break ;
Original file line number Diff line number Diff line change 1+ #include <dc/sound/sound.h>
2+ #include <dc/sound/midi.h>
3+
4+ #include "arm/aica_cmd_iface.h"
5+
6+ void snd_midi (uint8 midi ) {
7+ AICA_CMDSTR_MIDI (tmp , cmd , cmdmidi );
8+
9+ cmd -> cmd = AICA_CMD_MIDI ;
10+ cmd -> timestamp = 0 ;
11+ cmd -> size = AICA_CMDSTR_MIDI_SIZE ;
12+ * cmdmidi = midi ;
13+ snd_sh4_to_aica (tmp , cmd -> size );
14+ }
You can’t perform that action at this time.
0 commit comments