dmusic: Use a dmusic_midi.h header for MIDI messages.
This commit is contained in:
parent
65e388137c
commit
2c4fc0adcf
4 changed files with 52 additions and 9 deletions
|
@ -19,6 +19,7 @@
|
|||
*/
|
||||
|
||||
#include "dmime_private.h"
|
||||
#include "dmusic_midi.h"
|
||||
#include "wine/rbtree.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(dmime);
|
||||
|
@ -1702,12 +1703,12 @@ static HRESULT WINAPI performance_tool_ProcessPMsg(IDirectMusicTool *iface,
|
|||
|
||||
msg->mtTime += note->nOffset;
|
||||
if (FAILED(hr = performance_send_midi_pmsg(This, msg, DMUS_PMSGF_REFTIME | DMUS_PMSGF_MUSICTIME | DMUS_PMSGF_TOOL_IMMEDIATE,
|
||||
0x90 /* NOTE_ON */, note->bMidiValue, note->bVelocity)))
|
||||
MIDI_NOTE_ON, note->bMidiValue, note->bVelocity)))
|
||||
WARN("Failed to translate message to MIDI, hr %#lx\n", hr);
|
||||
|
||||
msg->mtTime += note->mtDuration;
|
||||
if (FAILED(hr = performance_send_midi_pmsg(This, msg, DMUS_PMSGF_MUSICTIME | DMUS_PMSGF_TOOL_QUEUE,
|
||||
0x80 /* NOTE_OFF */, note->bMidiValue, 0)))
|
||||
MIDI_NOTE_OFF, note->bMidiValue, 0)))
|
||||
WARN("Failed to translate message to MIDI, hr %#lx\n", hr);
|
||||
|
||||
break;
|
||||
|
@ -1718,15 +1719,15 @@ static HRESULT WINAPI performance_tool_ProcessPMsg(IDirectMusicTool *iface,
|
|||
DMUS_PATCH_PMSG *patch = (DMUS_PATCH_PMSG *)msg;
|
||||
|
||||
if (FAILED(hr = performance_send_midi_pmsg(This, msg, DMUS_PMSGF_REFTIME | DMUS_PMSGF_MUSICTIME | DMUS_PMSGF_TOOL_IMMEDIATE,
|
||||
0xb0 /* Control Change */, 0x00 /* CC: Bank MSB */, patch->byMSB)))
|
||||
MIDI_CONTROL_CHANGE, MIDI_CC_BANK_MSB, patch->byMSB)))
|
||||
WARN("Failed to translate message to MIDI, hr %#lx\n", hr);
|
||||
|
||||
if (FAILED(hr = performance_send_midi_pmsg(This, msg, DMUS_PMSGF_REFTIME | DMUS_PMSGF_MUSICTIME | DMUS_PMSGF_TOOL_IMMEDIATE,
|
||||
0xb0 /* Control Change */, 0x20 /* CC: Bank LSB */, patch->byLSB)))
|
||||
MIDI_CONTROL_CHANGE, MIDI_CC_BANK_LSB, patch->byLSB)))
|
||||
WARN("Failed to translate message to MIDI, hr %#lx\n", hr);
|
||||
|
||||
if (FAILED(hr = performance_send_midi_pmsg(This, msg, DMUS_PMSGF_REFTIME | DMUS_PMSGF_MUSICTIME | DMUS_PMSGF_TOOL_IMMEDIATE,
|
||||
0xc0 /* Program Change */, patch->byInstrument, 0)))
|
||||
MIDI_PROGRAM_CHANGE, patch->byInstrument, 0)))
|
||||
WARN("Failed to translate message to MIDI, hr %#lx\n", hr);
|
||||
|
||||
break;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
MODULE = dmsynth.dll
|
||||
IMPORTS = $(FLUIDSYNTH_PE_LIBS) dxguid uuid ole32 advapi32 user32
|
||||
EXTRAINCL = $(FLUIDSYNTH_PE_CFLAGS)
|
||||
PARENTSRC = ../dmusic
|
||||
|
||||
C_SRCS = \
|
||||
dmsynth_main.c \
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "dmksctrl.h"
|
||||
|
||||
#include "dmsynth_private.h"
|
||||
#include "dmusic_midi.h"
|
||||
#include "dls2.h"
|
||||
|
||||
#include <fluidsynth.h>
|
||||
|
@ -1063,16 +1064,16 @@ static HRESULT WINAPI synth_Render(IDirectMusicSynth8 *iface, short *buffer,
|
|||
|
||||
switch (status)
|
||||
{
|
||||
case 0x80:
|
||||
case MIDI_NOTE_OFF:
|
||||
fluid_synth_noteoff(This->fluid_synth, chan, event->midi[1]);
|
||||
break;
|
||||
case 0x90:
|
||||
case MIDI_NOTE_ON:
|
||||
fluid_synth_noteon(This->fluid_synth, chan, event->midi[1], event->midi[2]);
|
||||
break;
|
||||
case 0xb0:
|
||||
case MIDI_CONTROL_CHANGE:
|
||||
fluid_synth_cc(This->fluid_synth, chan, event->midi[1], event->midi[2]);
|
||||
break;
|
||||
case 0xc0:
|
||||
case MIDI_PROGRAM_CHANGE:
|
||||
fluid_synth_program_change(This->fluid_synth, chan, event->midi[1]);
|
||||
break;
|
||||
default:
|
||||
|
|
40
dlls/dmusic/dmusic_midi.h
Normal file
40
dlls/dmusic/dmusic_midi.h
Normal file
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Copyright 2023 Rémi Bernon for CodeWeavers
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "stdarg.h"
|
||||
#include "stddef.h"
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
|
||||
enum midi_message
|
||||
{
|
||||
MIDI_NOTE_OFF = 0x80,
|
||||
MIDI_NOTE_ON = 0x90,
|
||||
MIDI_KEY_PRESSURE = 0xa0,
|
||||
MIDI_CONTROL_CHANGE = 0xb0,
|
||||
MIDI_PROGRAM_CHANGE = 0xc0,
|
||||
MIDI_CHANNEL_PRESSURE = 0xd0,
|
||||
MIDI_PITCH_BEND_CHANGE = 0xe0,
|
||||
};
|
||||
|
||||
enum midi_control
|
||||
{
|
||||
MIDI_CC_BANK_MSB = 0x00,
|
||||
MIDI_CC_BANK_LSB = 0x20,
|
||||
};
|
Loading…
Add table
Reference in a new issue