Skip to content

Commit

Permalink
Add modification of Pioneer DDJ-SR device name for Rekordbox in Linux.
Browse files Browse the repository at this point in the history
  • Loading branch information
erhan- committed Jun 15, 2019
1 parent c674cee commit c727c64
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion dlls/winealsa.drv/midi.c
Expand Up @@ -1221,7 +1221,7 @@ static void ALSA_AddMidiPort(snd_seq_client_info_t* cinfo, snd_seq_port_info_t*
MODM_NumDevs++;
}
if (cap & SND_SEQ_PORT_CAP_READ) {
TRACE("IN (%d:%s:%s:%d:%s:%x)\n",snd_seq_client_info_get_client(cinfo),
TRACE("IN with mod (%d:%s:%s:%d:%s:%x)\n",snd_seq_client_info_get_client(cinfo),
snd_seq_client_info_get_name(cinfo),
snd_seq_client_info_get_type(cinfo) == SND_SEQ_USER_CLIENT ? "user" : "kernel",
snd_seq_port_info_get_port(pinfo),
Expand All @@ -1248,13 +1248,27 @@ static void ALSA_AddMidiPort(snd_seq_client_info_t* cinfo, snd_seq_port_info_t*
/* Try to use both client and port names, if this is too long take the port name only.
In the second case the port name should be explicit enough due to its big size.
*/

/* The old and new Pioneer string */
static const WCHAR PioneerOldW[] = {'P','I','O','N','E','E','R',' ','D','D','J','-','S','R',' ','M','I','D','I',' ','1',0};
static const WCHAR PioneerNewW[] = {'P','I','O','N','E','E','R',' ','D','D','J','-','S','R',0};

if ( (strlen(snd_seq_client_info_get_name(cinfo)) + strlen(snd_seq_port_info_get_name(pinfo)) + 3) < MAXPNAMELEN ) {
sprintf(midiPortName, "%s - %s", snd_seq_client_info_get_name(cinfo), snd_seq_port_info_get_name(pinfo));
} else {
lstrcpynA(midiPortName, snd_seq_port_info_get_name(pinfo), MAXPNAMELEN);
}
MultiByteToWideChar(CP_UNIXCP, 0, midiPortName, -1, MidiInDev[MIDM_NumDevs].caps.szPname,
ARRAY_SIZE(MidiInDev[MIDM_NumDevs].caps.szPname));
/* Check if the device name looks like the old PIONEER string and change it in case */
if (wcsncmp(MidiInDev[MIDM_NumDevs].caps.szPname, PioneerOldW, lstrlenW(PioneerOldW)) != 0) {
TRACE("Changing PIONEER name.");
wcsncpy(MidiInDev[MIDM_NumDevs].caps.szPname, PioneerNewW, lstrlenW(PioneerNewW))
} else {
TRACE("Not changing PIONEER name.");
}


MidiInDev[MIDM_NumDevs].state = 0;

TRACE("MidiIn [%d]\tname='%s' support=%d\n"
Expand Down

0 comments on commit c727c64

Please sign in to comment.