source: src/midi_event.c @ 96fb8ad

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change on this file since 96fb8ad was 96fb8ad, checked in by Paul Brossier <piem@altern.org>, 19 years ago

import 0.1.7.1

  • Property mode set to 100644
File size: 4.1 KB
Line 
1/*
2 *
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Library General Public License
5 * as published by the Free Software Foundation; either version 2 of
6 * the License, or (at your option) any later version.
7 *
8 * This library is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 * Library General Public License for more details.
12 * 
13 * You should have received a copy of the GNU Library General Public
14 * License along with this library; if not, write to the Free
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
16 * 02111-1307, USA
17 */
18
19/* this file originally taken from FluidSynth - A Software Synthesizer
20 * Copyright (C) 2003  Peter Hanappe and others.
21 */
22
23#include "aubio_priv.h"
24#include "midi_event.h"
25#include "midi.h"
26
27/******************************************************
28 *
29 *     aubio_event_t
30 */
31
32/*
33 * new_aubio_midi_event
34 */
35aubio_midi_event_t* new_aubio_midi_event()
36{
37  aubio_midi_event_t* evt;
38  evt = AUBIO_NEW(aubio_midi_event_t);
39  if (evt == NULL) {
40    AUBIO_ERR( "Out of memory");
41    return NULL;
42  }
43  evt->dtime = 0;
44  evt->type = 0;
45  evt->channel = 0;
46  evt->param1 = 0;
47  evt->param2 = 0;
48  evt->next = NULL;
49  return evt;
50}
51
52/** del_aubio_midi_event */
53int del_aubio_midi_event(aubio_midi_event_t* evt)
54{
55  aubio_midi_event_t *temp;
56  while(evt)
57  {
58    temp = evt->next;
59    AUBIO_FREE(evt);
60    evt = temp;
61  }
62  return AUBIO_OK;
63}
64
65/*
66 * aubio_midi_event_get_type
67 */
68int aubio_midi_event_get_type(aubio_midi_event_t* evt)
69{
70  return evt->type;
71}
72
73/*
74 * aubio_midi_event_set_type
75 */
76int aubio_midi_event_set_type(aubio_midi_event_t* evt, int type)
77{
78  evt->type = type;
79  return AUBIO_OK;
80}
81
82/*
83 * aubio_midi_event_get_channel
84 */
85int aubio_midi_event_get_channel(aubio_midi_event_t* evt)
86{
87  return evt->channel;
88}
89
90/*
91 * aubio_midi_event_set_channel
92 */
93int aubio_midi_event_set_channel(aubio_midi_event_t* evt, int chan)
94{
95  evt->channel = chan;
96  return AUBIO_OK;
97}
98
99/*
100 * aubio_midi_event_get_key
101 */
102int aubio_midi_event_get_key(aubio_midi_event_t* evt)
103{
104  return evt->param1;
105}
106
107/*
108 * aubio_midi_event_set_key
109 */
110int aubio_midi_event_set_key(aubio_midi_event_t* evt, int v)
111{
112  evt->param1 = v;
113  return AUBIO_OK;
114}
115
116/*
117 * aubio_midi_event_get_velocity
118 */
119int aubio_midi_event_get_velocity(aubio_midi_event_t* evt)
120{
121  return evt->param2;
122}
123
124/*
125 * aubio_midi_event_set_velocity
126 */
127int aubio_midi_event_set_velocity(aubio_midi_event_t* evt, int v)
128{
129  evt->param2 = v;
130  return AUBIO_OK;
131}
132
133/*
134 * aubio_midi_event_get_control
135 */
136int aubio_midi_event_get_control(aubio_midi_event_t* evt)
137{
138  return evt->param1;
139}
140
141/*
142 * aubio_midi_event_set_control
143 */
144int aubio_midi_event_set_control(aubio_midi_event_t* evt, int v)
145{
146  evt->param1 = v;
147  return AUBIO_OK;
148}
149
150/*
151 * aubio_midi_event_get_value
152 */
153int aubio_midi_event_get_value(aubio_midi_event_t* evt)
154{
155  return evt->param2;
156}
157
158/*
159 * aubio_midi_event_set_value
160 */
161int aubio_midi_event_set_value(aubio_midi_event_t* evt, int v)
162{
163  evt->param2 = v;
164  return AUBIO_OK;
165}
166
167int aubio_midi_event_get_program(aubio_midi_event_t* evt)
168{
169  return evt->param1;
170}
171
172int aubio_midi_event_set_program(aubio_midi_event_t* evt, int val)
173{
174  evt->param1 = val;
175  return AUBIO_OK;
176}
177
178int aubio_midi_event_get_pitch(aubio_midi_event_t* evt)
179{
180  return evt->param1;
181}
182
183int aubio_midi_event_set_pitch(aubio_midi_event_t* evt, int val)
184{
185  evt->param1 = val;
186  return AUBIO_OK;
187}
188
189/*
190 * aubio_midi_event_get_param1
191 */
192/* int aubio_midi_event_get_param1(aubio_midi_event_t* evt) */
193/* { */
194/*   return evt->param1; */
195/* } */
196
197/*
198 * aubio_midi_event_set_param1
199 */
200/* int aubio_midi_event_set_param1(aubio_midi_event_t* evt, int v) */
201/* { */
202/*   evt->param1 = v; */
203/*   return AUBIO_OK; */
204/* } */
205
206/*
207 * aubio_midi_event_get_param2
208 */
209/* int aubio_midi_event_get_param2(aubio_midi_event_t* evt) */
210/* { */
211/*   return evt->param2; */
212/* } */
213
214/*
215 * aubio_midi_event_set_param2
216 */
217/* int aubio_midi_event_set_param2(aubio_midi_event_t* evt, int v) */
218/* { */
219/*   evt->param2 = v; */
220/*   return AUBIO_OK; */
221/* } */
222
Note: See TracBrowser for help on using the repository browser.