mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-18 04:36:30 +01:00
[P4/git history rebuild] unconditionally apply waves backend changes to get them aligned with initial P4 condition
This commit is contained in:
parent
e9d11b4f59
commit
4e3896d13e
1 changed files with 143 additions and 143 deletions
|
|
@ -1,143 +1,143 @@
|
||||||
/* pmwin.c -- PortMidi os-dependent code */
|
/* pmwin.c -- PortMidi os-dependent code */
|
||||||
|
|
||||||
/* This file only needs to implement:
|
/* This file only needs to implement:
|
||||||
pm_init(), which calls various routines to register the
|
pm_init(), which calls various routines to register the
|
||||||
available midi devices,
|
available midi devices,
|
||||||
Pm_GetDefaultInputDeviceID(), and
|
Pm_GetDefaultInputDeviceID(), and
|
||||||
Pm_GetDefaultOutputDeviceID().
|
Pm_GetDefaultOutputDeviceID().
|
||||||
This file must
|
This file must
|
||||||
be separate from the main portmidi.c file because it is system
|
be separate from the main portmidi.c file because it is system
|
||||||
dependent, and it is separate from, say, pmwinmm.c, because it
|
dependent, and it is separate from, say, pmwinmm.c, because it
|
||||||
might need to register devices for winmm, directx, and others.
|
might need to register devices for winmm, directx, and others.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "stdlib.h"
|
#include "stdlib.h"
|
||||||
#include "portmidi.h"
|
#include "portmidi.h"
|
||||||
#include "pmutil.h"
|
#include "pmutil.h"
|
||||||
#include "pminternal.h"
|
#include "pminternal.h"
|
||||||
#include "pmwinmm.h"
|
#include "pmwinmm.h"
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
#include "stdio.h"
|
#include "stdio.h"
|
||||||
#endif
|
#endif
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
/* pm_exit is called when the program exits.
|
/* pm_exit is called when the program exits.
|
||||||
It calls pm_term to make sure PortMidi is properly closed.
|
It calls pm_term to make sure PortMidi is properly closed.
|
||||||
If DEBUG is on, we prompt for input to avoid losing error messages.
|
If DEBUG is on, we prompt for input to avoid losing error messages.
|
||||||
*/
|
*/
|
||||||
static void pm_exit(void) {
|
static void pm_exit(void) {
|
||||||
pm_term();
|
pm_term();
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
#define STRING_MAX 80
|
#define STRING_MAX 80
|
||||||
{
|
{
|
||||||
char line[STRING_MAX];
|
char line[STRING_MAX];
|
||||||
printf("Type ENTER...\n");
|
printf("Type ENTER...\n");
|
||||||
/* note, w/o this prompting, client console application can not see one
|
/* note, w/o this prompting, client console application can not see one
|
||||||
of its errors before closing. */
|
of its errors before closing. */
|
||||||
fgets(line, STRING_MAX, stdin);
|
fgets(line, STRING_MAX, stdin);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* pm_init is the windows-dependent initialization.*/
|
/* pm_init is the windows-dependent initialization.*/
|
||||||
void pm_init(void)
|
void pm_init(void)
|
||||||
{
|
{
|
||||||
atexit(pm_exit);
|
atexit(pm_exit);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("registered pm_exit with atexit()\n");
|
printf("registered pm_exit with atexit()\n");
|
||||||
#endif
|
#endif
|
||||||
pm_winmm_init();
|
pm_winmm_init();
|
||||||
/* initialize other APIs (DirectX?) here */
|
/* initialize other APIs (DirectX?) here */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void pm_term(void) {
|
void pm_term(void) {
|
||||||
pm_winmm_term();
|
pm_winmm_term();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static PmDeviceID pm_get_default_device_id(int is_input, char *key) {
|
static PmDeviceID pm_get_default_device_id(int is_input, char *key) {
|
||||||
HKEY hkey;
|
HKEY hkey;
|
||||||
#define PATTERN_MAX 256
|
#define PATTERN_MAX 256
|
||||||
char pattern[PATTERN_MAX];
|
char pattern[PATTERN_MAX];
|
||||||
long pattern_max = PATTERN_MAX;
|
long pattern_max = PATTERN_MAX;
|
||||||
DWORD dwType;
|
DWORD dwType;
|
||||||
/* Find first input or device -- this is the default. */
|
/* Find first input or device -- this is the default. */
|
||||||
PmDeviceID id = pmNoDevice;
|
PmDeviceID id = pmNoDevice;
|
||||||
int i, j;
|
int i, j;
|
||||||
Pm_Initialize(); /* make sure descriptors exist! */
|
Pm_Initialize(); /* make sure descriptors exist! */
|
||||||
for (i = 0; i < pm_descriptor_index; i++) {
|
for (i = 0; i < pm_descriptor_index; i++) {
|
||||||
if (descriptors[i].pub.input == is_input) {
|
if (descriptors[i].pub.input == is_input) {
|
||||||
id = i;
|
id = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Look in registry for a default device name pattern. */
|
/* Look in registry for a default device name pattern. */
|
||||||
if (RegOpenKeyEx(HKEY_CURRENT_USER, "Software", 0, KEY_READ, &hkey) !=
|
if (RegOpenKeyEx(HKEY_CURRENT_USER, "Software", 0, KEY_READ, &hkey) !=
|
||||||
ERROR_SUCCESS) {
|
ERROR_SUCCESS) {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
if (RegOpenKeyEx(hkey, "JavaSoft", 0, KEY_READ, &hkey) !=
|
if (RegOpenKeyEx(hkey, "JavaSoft", 0, KEY_READ, &hkey) !=
|
||||||
ERROR_SUCCESS) {
|
ERROR_SUCCESS) {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
if (RegOpenKeyEx(hkey, "Prefs", 0, KEY_READ, &hkey) !=
|
if (RegOpenKeyEx(hkey, "Prefs", 0, KEY_READ, &hkey) !=
|
||||||
ERROR_SUCCESS) {
|
ERROR_SUCCESS) {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
if (RegOpenKeyEx(hkey, "/Port/Midi", 0, KEY_READ, &hkey) !=
|
if (RegOpenKeyEx(hkey, "/Port/Midi", 0, KEY_READ, &hkey) !=
|
||||||
ERROR_SUCCESS) {
|
ERROR_SUCCESS) {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
if (RegQueryValueEx(hkey, key, NULL, &dwType, pattern, &pattern_max) !=
|
if (RegQueryValueEx(hkey, key, NULL, &dwType, pattern, &pattern_max) !=
|
||||||
ERROR_SUCCESS) {
|
ERROR_SUCCESS) {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* decode pattern: upper case encoded with "/" prefix */
|
/* decode pattern: upper case encoded with "/" prefix */
|
||||||
i = j = 0;
|
i = j = 0;
|
||||||
while (pattern[i]) {
|
while (pattern[i]) {
|
||||||
if (pattern[i] == '/' && pattern[i + 1]) {
|
if (pattern[i] == '/' && pattern[i + 1]) {
|
||||||
pattern[j++] = toupper(pattern[++i]);
|
pattern[j++] = toupper(pattern[++i]);
|
||||||
} else {
|
} else {
|
||||||
pattern[j++] = tolower(pattern[i]);
|
pattern[j++] = tolower(pattern[i]);
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
pattern[j] = 0; /* end of string */
|
pattern[j] = 0; /* end of string */
|
||||||
|
|
||||||
/* now pattern is the string from the registry; search for match */
|
/* now pattern is the string from the registry; search for match */
|
||||||
i = pm_find_default_device(pattern, is_input);
|
i = pm_find_default_device(pattern, is_input);
|
||||||
if (i != pmNoDevice) {
|
if (i != pmNoDevice) {
|
||||||
id = i;
|
id = i;
|
||||||
}
|
}
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PmDeviceID Pm_GetDefaultInputDeviceID() {
|
PmDeviceID Pm_GetDefaultInputDeviceID() {
|
||||||
return pm_get_default_device_id(TRUE,
|
return pm_get_default_device_id(TRUE,
|
||||||
"/P/M_/R/E/C/O/M/M/E/N/D/E/D_/I/N/P/U/T_/D/E/V/I/C/E");
|
"/P/M_/R/E/C/O/M/M/E/N/D/E/D_/I/N/P/U/T_/D/E/V/I/C/E");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PmDeviceID Pm_GetDefaultOutputDeviceID() {
|
PmDeviceID Pm_GetDefaultOutputDeviceID() {
|
||||||
return pm_get_default_device_id(FALSE,
|
return pm_get_default_device_id(FALSE,
|
||||||
"/P/M_/R/E/C/O/M/M/E/N/D/E/D_/O/U/T/P/U/T_/D/E/V/I/C/E");
|
"/P/M_/R/E/C/O/M/M/E/N/D/E/D_/O/U/T/P/U/T_/D/E/V/I/C/E");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#include "stdio.h"
|
#include "stdio.h"
|
||||||
|
|
||||||
void *pm_alloc(size_t s) {
|
void *pm_alloc(size_t s) {
|
||||||
return malloc(s);
|
return malloc(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void pm_free(void *ptr) {
|
void pm_free(void *ptr) {
|
||||||
free(ptr);
|
free(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue