This file is indexed.

/usr/include/drumstick/alsaport.h is in libdrumstick-dev 0.5.0-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
/*
    MIDI Sequencer C++ library
    Copyright (C) 2006-2010, Pedro Lopez-Cabanillas <plcl@users.sf.net>

    This library is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License along
    with this program; if not, write to the Free Software Foundation, Inc.,
    51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/

#ifndef DRUMSTICK_ALSAPORT_H
#define DRUMSTICK_ALSAPORT_H

#include "subscription.h"
#include <QObject>

/**
 * @file alsaport.h
 * Classes managing ALSA Sequencer ports.
 * @defgroup ALSAPort ALSA Sequencer Ports
 * @{
 */

namespace drumstick {

class MidiClient;

/**
 * Port information container
 */
class DRUMSTICK_EXPORT PortInfo
{
    friend class MidiPort;
    friend class ClientInfo;
    friend class MidiClient;

public:
    PortInfo();
    PortInfo(const PortInfo& other);
    PortInfo(snd_seq_port_info_t* other);
    PortInfo(MidiClient* seq, const int client, const int port);
    PortInfo(MidiClient* seq, const int port);
    virtual ~PortInfo();
    PortInfo* clone();
    PortInfo& operator=(const PortInfo& other);
    int getSizeOfInfo() const;

    int getClient();
    int getPort();
    /** Gets the client name. @see setClientName() */
    QString getClientName() const { return m_ClientName; }
    const snd_seq_addr_t* getAddr();
    QString getName();
    unsigned int getCapability();
    unsigned int getType();
    int getMidiChannels();
    int getMidiVoices();
    int getSynthVoices();
    int getReadUse();
    int getWriteUse();
    int getPortSpecified();
    void setClient(int client);
    void setPort(int port);
    void setAddr(const snd_seq_addr_t* addr);
    void setName( QString const& name );
    void setCapability(unsigned int capability);
    void setType(unsigned int type);
    void setMidiChannels(int channels);
    void setMidiVoices(int voices);
    void setSynthVoices(int voices);
    void setPortSpecified(int val);
    SubscribersList getReadSubscribers() const;
    SubscribersList getWriteSubscribers() const;

    bool getTimestamping();
    bool getTimestampReal();
    int getTimestampQueue();
    void setTimestamping(bool value);
    void setTimestampReal(bool value);
    void setTimestampQueue(int queueId);

protected:
    void readSubscribers(MidiClient* seq);
    void freeSubscribers();

    /**
     * Sets the client name. @see getClientName()
     * @param name Client name
     */
    void setClientName(QString name) { m_ClientName = name; }

private:
    snd_seq_port_info_t* m_Info;
    QString m_ClientName;
    SubscribersList m_ReadSubscribers;
    SubscribersList m_WriteSubscribers;
};


/**
 * List of port information objects
 */
typedef QList<PortInfo> PortInfoList;

/**
 * Port management.
 *
 * This class represents an ALSA sequencer port.
 */
class DRUMSTICK_EXPORT MidiPort : public QObject
{
    Q_OBJECT
    friend class MidiClient;

public:
    MidiPort( QObject* parent = 0 );
    virtual ~MidiPort();

    void attach( MidiClient* seq );
    void detach();
    void subscribe( Subscription* subs );
    void unsubscribe( Subscription* subs );
    void unsubscribeAll();
    void unsubscribeTo( QString const& name );
    void unsubscribeTo( PortInfo* port );
    void unsubscribeTo( const snd_seq_addr_t* addr );
    void unsubscribeFrom( QString const& name );
    void unsubscribeFrom( PortInfo* port );
    void unsubscribeFrom( const snd_seq_addr_t* addr );
    void subscribeTo( PortInfo* port);
    void subscribeTo( int client, int port );
    void subscribeTo( QString const& name );
    void subscribeFrom( PortInfo* port );
    void subscribeFrom( int client, int port );
    void subscribeFrom( QString const& name );
    void subscribeFromAnnounce();
    void updateSubscribers();
    SubscriptionsList getSubscriptions() const;
    PortInfoList getReadSubscribers();
    PortInfoList getWriteSubscribers();
    void updateConnectionsTo(const PortInfoList& desired);
    void updateConnectionsFrom(const PortInfoList& desired);

    static bool containsAddress(const snd_seq_addr_t* addr, const PortInfoList& lst);

    void applyPortInfo();
    QString getPortName();
    void setPortName( QString const& newName);
    int getPortId();
    unsigned int getCapability();
    void setCapability( unsigned int newValue);
    unsigned int getPortType();
    void setPortType( unsigned int newValue);
    int getMidiChannels();
    void setMidiChannels(int newValue);
    int getMidiVoices();
    void setMidiVoices(int newValue);
    int getSynthVoices();
    void setSynthVoices(int newValue);
    bool getTimestamping();
    bool getTimestampReal();
    int getTimestampQueue();
    void setTimestamping(bool value);
    void setTimestampReal(bool value);
    void setTimestampQueue(int queueId);

signals:
    /**
     * Signal emitted when an internal subscription is done.
     * @param port MIDI port object pointer
     * @param subs Subscription object pointer
     */
    void subscribed(MidiPort* port, Subscription* subs);
    /**
     * Signal emitted when the MidiClient has changed
     * @param port MIDI port object pinter
     * @param seq MidiClient object pointer
     */
    void midiClientChanged(MidiPort* port, MidiClient* seq);
    /**
     * Signal emitted when the port is attached to a MidiClient
     * @param port MIDI port object pointer
     */
    void attached(MidiPort* port);
    /**
     * Signal emitted when the port is detached from a MidiClient
     * @param port MIDI port object pointer
     */
    void detached(MidiPort* port);

protected:
    PortInfo* getPortInfo();
    void freeSubscriptions();
    void setMidiClient( MidiClient* seq );

private:
    MidiClient* m_MidiClient;
    PortInfo m_Info;
    bool m_Attached;
    SubscriptionsList m_Subscriptions;
};

/**
 * List of Ports instances.
 */
typedef QList<MidiPort*> MidiPortList;

}

/** @} */

#endif //DRUMSTICK_ALSAPORT_H