*** empty log message ***
[chuck-blob.git] / v2 / skiniio_skini.h
blob465aa9e6df940a3451ebaa61151f021b46147082
1 /*----------------------------------------------------------------------------
2 ChucK Concurrent, On-the-fly Audio Programming Language
3 Compiler and Virtual Machine
5 Copyright (c) 2004 Ge Wang and Perry R. Cook. All rights reserved.
6 http://chuck.cs.princeton.edu/
7 http://soundlab.cs.princeton.edu/
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22 U.S.A.
23 -----------------------------------------------------------------------------*/
25 //-----------------------------------------------------------------------------
26 // file: skiniio.h
27 // desc: midi io header
29 // author: Ge Wang (gewang@cs.princeton.edu)
30 // Perry R. Cook (prc@cs.princeton.edu)
31 //-----------------------------------------------------------------------------
32 #ifndef __SKINI_IO_H__
33 #define __SKINI_IO_H__
35 #include "chuck_def.h"
36 #include "skini.h" // actually, the skini class is in ugen_stk.cpp, so this is wrong.
37 #include "util_buffers.h"
42 //-----------------------------------------------------------------------------
43 // stuff
44 //-----------------------------------------------------------------------------
45 /*#define MIDI_NOTEON 0x90
46 #define MIDI_NOTEOFF 0x80
47 #define MIDI_POLYPRESS 0xa0
48 #define MIDI_CTRLCHANGE 0xb0
49 #define MIDI_PROGCHANGE 0xc0
50 #define MIDI_CHANPRESS 0xd0
51 #define MIDI_PITCHBEND 0xe0
52 #define MIDI_ALLNOTESOFF 0x7b
57 //-----------------------------------------------------------------------------
58 // definitions
59 //-----------------------------------------------------------------------------
60 //struct SkiniMsg
61 //{
62 // //! A message structure to store and pass parsed SKINI messages.
63 // long type; /*!< The message type, as defined in SKINI.msg. */
64 // long channel; /*!< The message channel (not limited to 16!). */
65 // float time; /*!< The message time stamp in seconds (delta or absolute). */
66 // std::vector<float> floatValues; /*!< The message values read as floats (values are type-specific). */
67 // std::vector<long> intValues; /*!< The message values read as ints (number and values are type-specific). */
68 // std::string remainder; /*!< Any remaining message data, read as ascii text. */
70 // // Default constructor.
71 // SkiniMsg()
72 // :type(0), channel(0), time(0.0), floatValues(2), intValues(2) {}
73 //};
75 //uh...
76 //#define SkiniMsg Skini::Message
78 struct SkiniMsg
80 int type;
81 int channel;
82 float time;
83 float data1; // floatValues[0]
84 float data2; // floatValues[1]
88 //-----------------------------------------------------------------------------
89 // name: class SkiniOut
90 // desc: midi out
91 //-----------------------------------------------------------------------------
92 class SkiniOut
94 public:
95 SkiniOut();
96 ~SkiniOut();
98 public:
99 t_CKBOOL open( const char * filename = NULL );
100 t_CKBOOL close();
102 public:
103 t_CKUINT send( const SkiniMsg * msg );
105 /*public:
106 t_CKUINT noteon( t_CKUINT channel, t_CKUINT note, t_CKUINT velocity );
107 t_CKUINT noteoff( t_CKUINT channel, t_CKUINT note, t_CKUINT velocity );
108 t_CKUINT polypress( t_CKUINT channel, t_CKUINT note, t_CKUINT pressure );
109 t_CKUINT ctrlchange( t_CKUINT channel, t_CKUINT ctrl_num, t_CKUINT ctrl_val );
110 t_CKUINT progchange( t_CKUINT channel, t_CKUINT patch );
111 t_CKUINT chanpress( t_CKUINT channel, t_CKUINT pressure );
112 t_CKUINT pitchbend( t_CKUINT channel, t_CKUINT bend_val );
113 t_CKUINT allnotesoff( t_CKUINT channel );
115 public:
116 Skini * skout;
117 //std::vector<unsigned char> m_msg;
118 char * m_filename;
119 t_CKBOOL m_valid;
125 //-----------------------------------------------------------------------------
126 // name: class SkiniIn
127 // desc: midi
128 //-----------------------------------------------------------------------------
129 class SkiniIn : public Chuck_Event
131 public:
132 SkiniIn();
133 ~SkiniIn();
135 public:
136 t_CKBOOL open( const char * filename = NULL );
137 t_CKBOOL close();
139 public:
140 t_CKUINT recv( SkiniMsg * msg );
142 public:
143 char * m_filename;
144 t_CKBOOL m_valid;
145 Skini * skin;
147 //CBuffer * m_buffer;
148 //t_CKUINT m_read_index;
149 //RtMidiIn * min;
150 //t_CKUINT m_device_num;
151 //t_CKUINT m_ref_count;
152 //Chuck_Object * SELF;
153 // static void CALLBACK cb_midi_input( HMIDIIN hm_in, t_CKUINT msg,
154 // DWORD instance, DWORD param1, DWORD param2 );
158 #endif