Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1173)

Unified Diff: media/midi/midi_manager_alsa.h

Issue 264973012: Use seq instead of rawmidi for MidiManagerAlsa (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Constify a few last things Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | media/midi/midi_manager_alsa.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/midi/midi_manager_alsa.h
diff --git a/media/midi/midi_manager_alsa.h b/media/midi/midi_manager_alsa.h
index 04e1d09907086aaafeaae0ab106d951b8abb9642..c523bb91f54f662f890c6cb6a01400ba6dc626d8 100644
--- a/media/midi/midi_manager_alsa.h
+++ b/media/midi/midi_manager_alsa.h
@@ -5,11 +5,13 @@
#ifndef MEDIA_MIDI_MIDI_MANAGER_ALSA_H_
#define MEDIA_MIDI_MIDI_MANAGER_ALSA_H_
-#include <poll.h>
+#include <alsa/asoundlib.h>
+#include <map>
#include <vector>
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
+#include "base/synchronization/lock.h"
#include "base/threading/thread.h"
#include "media/midi/midi_manager.h"
@@ -28,19 +30,36 @@ class MidiManagerAlsa : public MidiManager {
double timestamp) OVERRIDE;
private:
+ // An internal callback that runs on MidiSendThread.
+ void SendMidiData(uint32 port_index,
+ const std::vector<uint8>& data);
+
void EventReset();
void EventLoop();
- class MidiDeviceInfo;
- std::vector<scoped_refptr<MidiDeviceInfo> > in_devices_;
- std::vector<scoped_refptr<MidiDeviceInfo> > out_devices_;
+ // Alsa seq handles.
+ snd_seq_t* in_client_;
+ snd_seq_t* out_client_;
+ int out_client_id_;
+
+ // One input port, many output ports.
+ int in_port_;
+ std::vector<int> out_ports_;
+
+ // Mapping from Alsa client:port to our index.
+ typedef std::map<int, uint32> SourceMap;
+ SourceMap source_map_;
+
+ // Alsa event <-> MIDI coders.
+ snd_midi_event_t* decoder_;
+ typedef std::vector<snd_midi_event_t*> EncoderList;
+ EncoderList encoders_;
+
base::Thread send_thread_;
base::Thread event_thread_;
- // Used for shutting down the |event_thread_| safely.
- int pipe_fd_[2];
- // Used for polling input MIDI ports and |pipe_fd_| in |event_thread_|.
- std::vector<struct pollfd> poll_fds_;
+ bool event_thread_shutdown_; // guarded by shutdown_lock_
+ base::Lock shutdown_lock_; // guards event_thread_shutdown_
DISALLOW_COPY_AND_ASSIGN(MidiManagerAlsa);
};
« no previous file with comments | « no previous file | media/midi/midi_manager_alsa.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698