/[svn]/linuxsampler/trunk/src/drivers/midi/MidiInputDeviceCoreMidi.h
ViewVC logotype

Diff of /linuxsampler/trunk/src/drivers/midi/MidiInputDeviceCoreMidi.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1149 by schoenebeck, Sat Apr 7 22:32:47 2007 UTC revision 2434 by schoenebeck, Thu Mar 7 19:23:24 2013 UTC
# Line 1  Line 1 
1  /***************************************************************************  /***************************************************************************
2   *                                                                         *   *                                                                         *
3   *   Copyright (C) 2004, 2005 Grame                                        *   *   Copyright (C) 2004, 2005 Grame                                        *
4   *   Copyright (C) 2007 Christian Schoenebeck                              *   *   Copyright (C) 2005 - 2013 Christian Schoenebeck                       *
5   *                                                                         *   *                                                                         *
6   *   This program is free software; you can redistribute it and/or modify  *   *   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  *   *   it under the terms of the GNU General Public License as published by  *
# Line 24  Line 24 
24    
25  #include <CoreMIDI/MIDIServices.h>  #include <CoreMIDI/MIDIServices.h>
26    
27  #include "../../common/global.h"  #include "../../common/global_private.h"
28  #include "MidiInputDevice.h"  #include "MidiInputDevice.h"
29    
30  namespace LinuxSampler {  namespace LinuxSampler {
# Line 48  namespace LinuxSampler { Line 48  namespace LinuxSampler {
48                      class ParameterName : public MidiInputPort::ParameterName {                      class ParameterName : public MidiInputPort::ParameterName {
49                          public:                          public:
50                              ParameterName(MidiInputPort* pPort) throw (Exception);                              ParameterName(MidiInputPort* pPort) throw (Exception);
51                              virtual void OnSetValue(String s) throw (Exception);                              virtual void OnSetValue(String s) throw (Exception) OVERRIDE;
52                      };                      };
53    
54                      /** MIDI Port Parameter 'CORE_MIDI_BINDINGS'                      /** MIDI Port Parameter 'CORE_MIDI_BINDINGS'
# Line 59  namespace LinuxSampler { Line 59  namespace LinuxSampler {
59                      class ParameterCoreMidiBindings : public DeviceRuntimeParameterStrings {                      class ParameterCoreMidiBindings : public DeviceRuntimeParameterStrings {
60                          public:                          public:
61                              ParameterCoreMidiBindings(MidiInputPortCoreMidi* pPort);                              ParameterCoreMidiBindings(MidiInputPortCoreMidi* pPort);
62                              virtual String Description();                              virtual String Description() OVERRIDE;
63                              virtual bool Fix();                              virtual bool Fix() OVERRIDE;
64                              virtual std::vector<String> PossibilitiesAsString();                              virtual std::vector<String> PossibilitiesAsString() OVERRIDE;
65                              virtual void OnSetValue(std::vector<String> vS) throw (Exception);                              virtual void OnSetValue(std::vector<String> vS) throw (Exception) OVERRIDE;
66                          protected:                          protected:
67                              MidiInputPortCoreMidi* pPort;                              MidiInputPortCoreMidi* pPort;
68                      };                      };
69                                    
70                                            /** MIDI Port Parameter 'AUTO_BIND'
71                                             *
72                                             * If enabled, the port will automatically be connected to all
73                                             * CoreMIDI source endpoints at present and future.
74                                             */
75                                            class ParameterAutoBind : public DeviceRuntimeParameterBool {
76                                                    public:
77                                                            ParameterAutoBind(MidiInputPortCoreMidi* pPort);
78                                                            virtual String Description() OVERRIDE;
79                                                            virtual bool Fix() OVERRIDE;
80                                                            virtual void OnSetValue(bool b) throw (Exception) OVERRIDE;
81                                                    protected:
82                                                            MidiInputPortCoreMidi* pPort;
83                                            };
84                                    
85                                            void ProcessMidiEvents(const MIDIPacketList *pktlist);
86    
87                                          static void ReadProc(const MIDIPacketList *pktlist, void *refCon, void *connRefCon);                                          static void ReadProc(const MIDIPacketList *pktlist, void *refCon, void *connRefCon);
88                                          static int pPortID;                                          static int pPortID;
# Line 73  namespace LinuxSampler { Line 90  namespace LinuxSampler {
90                  protected:                  protected:
91                      MidiInputPortCoreMidi(MidiInputDeviceCoreMidi* pDevice) throw (MidiInputException);                      MidiInputPortCoreMidi(MidiInputDeviceCoreMidi* pDevice) throw (MidiInputException);
92                      ~MidiInputPortCoreMidi();                      ~MidiInputPortCoreMidi();
93                                            void connectToSource(MIDIEndpointRef source);
94                                            void connectToAllSources();
95                                            void onNewSourceAppeared(MIDIEndpointRef source);
96                                            void onNewSourceDisappeared(MIDIEndpointRef source);
97                      friend class MidiInputDeviceCoreMidi;                      friend class MidiInputDeviceCoreMidi;
98                  private:                  private:
99                      MidiInputPortCoreMidi* pDevice;                      MidiInputDeviceCoreMidi* pDevice;
100                                          MIDIEndpointRef pDestination;                                          MIDIEndpointRef pDestination;
101                                            std::vector<MIDIEndpointRef> bindings; //TODO: shall probably be protected by a mutex (since the CoreMIDI notification callback thread might also modify it when new sources appear or disappear)
102    
103                      friend class ParameterName;                      friend class ParameterName;
104                      friend class ParameterCoreMidiBindings;                      friend class ParameterCoreMidiBindings;
# Line 86  namespace LinuxSampler { Line 108  namespace LinuxSampler {
108              virtual ~MidiInputDeviceCoreMidi();              virtual ~MidiInputDeviceCoreMidi();
109    
110              // derived abstract methods from class 'MidiInputDevice'              // derived abstract methods from class 'MidiInputDevice'
111              void Listen(){}              void Listen() OVERRIDE {}
112              void StopListen(){}              void StopListen() OVERRIDE {}
113                          virtual String Driver();                          virtual String Driver() OVERRIDE;
114                          static String Name();                          static String Name();
115                          static String Description();                          static String Description();
116              static String Version();              static String Version();
# Line 100  namespace LinuxSampler { Line 122  namespace LinuxSampler {
122    
123          private:          private:
124                          MIDIClientRef   hCoreMidiClient;                          MIDIClientRef   hCoreMidiClient;
125                            MIDIPortRef pBridge;
126      };      };
127  }  }
128    

Legend:
Removed from v.1149  
changed lines
  Added in v.2434

  ViewVC Help
Powered by ViewVC