aboutsummaryrefslogtreecommitdiffhomepage
path: root/backends/winmidi.c
diff options
context:
space:
mode:
Diffstat (limited to 'backends/winmidi.c')
-rw-r--r--backends/winmidi.c29
1 files changed, 4 insertions, 25 deletions
diff --git a/backends/winmidi.c b/backends/winmidi.c
index 790257b..090e438 100644
--- a/backends/winmidi.c
+++ b/backends/winmidi.c
@@ -440,10 +440,9 @@ static int winmidi_match_output(char* prefix){
return -1;
}
-static int winmidi_start(){
- size_t n = 0, p;
+static int winmidi_start(size_t n, instance** inst){
+ size_t p;
int device, rv = -1;
- instance** inst = NULL;
winmidi_instance_data* data = NULL;
struct sockaddr_storage sockadd = {
0
@@ -453,18 +452,6 @@ static int winmidi_start(){
char* error = NULL;
DBGPF("winmidi main thread ID is %ld\n", GetCurrentThreadId());
- //fetch all instances
- if(mm_backend_instances(BACKEND_NAME, &n, &inst)){
- fprintf(stderr, "Failed to fetch instance list\n");
- return 1;
- }
-
- //no instances, we're done
- if(!n){
- free(inst);
- return 0;
- }
-
//output device list if requested
if(backend_config.list_devices){
winmidi_match_input(NULL);
@@ -552,20 +539,13 @@ static int winmidi_start(){
rv = 0;
bail:
- free(inst);
return rv;
}
-static int winmidi_shutdown(){
- size_t n, u;
- instance** inst = NULL;
+static int winmidi_shutdown(size_t n, instance** inst){
+ size_t u;
winmidi_instance_data* data = NULL;
- if(mm_backend_instances(BACKEND_NAME, &n, &inst)){
- fprintf(stderr, "Failed to fetch instance list\n");
- return 1;
- }
-
for(u = 0; u < n; u++){
data = (winmidi_instance_data*) inst[u]->impl;
free(data->read);
@@ -586,7 +566,6 @@ static int winmidi_shutdown(){
}
}
- free(inst);
closesocket(backend_config.socket_pair[0]);
closesocket(backend_config.socket_pair[1]);