1 /*
2     TiMidity++ -- MIDI to WAVE converter and player
3     Copyright (C) 1999-2002 Masanao Izumo <mo@goice.co.jp>
4     Copyright (C) 1995 Tuukka Toivonen <tt@cgs.fi>
5 
6     This program is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10 
11     This program is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15 
16     You should have received a copy of the GNU General Public License
17     along with this program; if not, write to the Free Software
18     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19 
20     mfnode.c
21 
22 	Macintosh interface for TiMidity
23 	by T.Nogami	<t-nogami@happy.email.ne.jp>
24 */
25 
26 #ifdef HAVE_CONFIG_H
27 #include "config.h"
28 #endif /* HAVE_CONFIG_H */
29 #ifndef NO_STRING_H
30 #include <string.h>
31 #else
32 #include <strings.h>
33 #endif
34 
35 #include "timidity.h"
36 #include "common.h"
37 #include "controls.h"
38 
39 #define ENTITY 1    /*EXTERN*/
40 #include "mfnode.h"
41 
42 Instr_comment instr_comment[MAX_CHANNELS];
43 
make_new_MFnode_entry(char * file)44 MFnode *make_new_MFnode_entry(char *file)
45 {
46     struct midi_file_info *infop;
47 #ifdef MIDI_TITLE
48     char *title = NULL;
49 #endif
50 
51     if(!strcmp(file, "-"))
52 	infop = get_midi_file_info("-", 1);
53     else
54     {
55 #ifdef MIDI_TITLE
56 	title = get_midi_title(file);
57 #else
58 	if(check_midi_file(file) < 0)
59 	    return NULL;
60 #endif /* MIDI_TITLE */
61 	infop = get_midi_file_info(file, 0);
62     }
63 
64     if(!strcmp(file, "-") || (infop && infop->format >= 0))
65     {
66 	MFnode *mfp;
67 	mfp = (MFnode *)safe_malloc(sizeof(MFnode));
68 	memset(mfp, 0, sizeof(MFnode));
69 #ifdef MIDI_TITLE
70 	mfp->title = title;
71 #endif /* MIDI_TITLE */
72 	mfp->file = safe_strdup(url_unexpand_home_dir(file));
73 	mfp->infop = infop;
74 	return mfp;
75     }
76 
77     ctl->cmsg(CMSG_WARNING, VERB_NORMAL, "%s: Not a midi file (Ignored)",
78 	url_unexpand_home_dir(file));
79     return NULL;
80 }
81 
indicator_set_prog(int ch,int val,char * comm)82 void indicator_set_prog(int ch, int val, char *comm)
83 {
84     instr_comment[ch].comm = comm;
85     instr_comment[ch].prog = val;
86     instr_comment[ch].last_note_on = 0.0;
87 }
88 
89 /*char *channel_instrum_name(int ch)
90 {
91     char *comm;
92     int bank;
93 
94     if(ISDRUMCHANNEL(ch))
95 		return "dram";
96     if(channel[ch].program == SPECIAL_PROGRAM)
97 		return "Special Program";
98 
99     if(IS_CURRENT_MOD_FILE)
100     {
101 		int pr;
102 		pr = channel[ch].special_sample;
103 		if(pr > 0 &&
104 			special_patch[pr] != NULL &&
105 			special_patch[pr]->name != NULL)
106 				return special_patch[pr]->name;
107 		return "MOD";
108     }
109 
110     bank = channel[ch].bank;
111     if(tonebank[bank] == NULL)
112 		bank = 0;
113     comm = tonebank[bank]->tone[channel[ch].program].comment;
114     if(comm == NULL)
115 		comm = tonebank[0]->tone[channel[ch].program].comment;
116     return comm;
117 }
118 */
119