~marcustomlinson/dspatch/overall_cleanup

« back to all changes in this revision

Viewing changes to example/DspAudioDevice.h

  • Committer: Marcus Tomlinson
  • Date: 2014-06-16 15:55:44 UTC
  • mfrom: (18.2.41 component_params)
  • Revision ID: marcus.tomlinson@canonical.com-20140616155544-o0ykqd90jtpx660o
Merged component_params

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/************************************************************************
2
2
DSPatch - Cross-Platform, Object-Oriented, Flow-Based Programming Library
3
 
Copyright (c) 2012-2013 Marcus Tomlinson
 
3
Copyright (c) 2012-2014 Marcus Tomlinson
4
4
 
5
5
This file is part of DSPatch.
6
6
 
34
34
class DspAudioDevice : public DspComponent
35
35
{
36
36
public:
 
37
  static std::string const pDeviceList; // List
 
38
  static std::string const pIsStreaming; // Bool
 
39
  static std::string const pBufferSize; // Int
 
40
  static std::string const pSampleRate; // Int
 
41
 
37
42
  DspAudioDevice();
38
43
  ~DspAudioDevice();
39
44
 
40
45
  bool SetDevice( short deviceIndex );
41
46
 
42
 
  std::string GetDeviceName( short deviceIndex );
43
 
  unsigned short GetDeviceInputCount( short deviceIndex );
44
 
  unsigned short GetDeviceOutputCount( short deviceIndex );
45
 
  unsigned short GetCurrentDevice();
46
 
  unsigned short GetDeviceCount();
47
 
 
48
 
  bool IsStreaming();
49
 
 
50
 
  void SetBufferSize( unsigned long bufferSize );
51
 
  void SetSampleRate( unsigned long sampleRate );
52
 
  unsigned long GetSampleRate();
 
47
  std::string GetDeviceName( short deviceIndex ) const;
 
48
  unsigned short GetDeviceInputCount( short deviceIndex ) const;
 
49
  unsigned short GetDeviceOutputCount( short deviceIndex ) const;
 
50
  unsigned short GetCurrentDevice() const;
 
51
  unsigned short GetDeviceCount() const;
 
52
 
 
53
  void SetBufferSize( int bufferSize );
 
54
  void SetSampleRate( int sampleRate );
 
55
 
 
56
  bool IsStreaming() const;
 
57
  int GetBufferSize() const;
 
58
  int GetSampleRate() const;
53
59
 
54
60
protected:
55
61
  virtual void Process_( DspSignalBus& inputs, DspSignalBus& outputs );
 
62
  virtual bool ParameterUpdating_( std::string const& name, DspParameter const& param );
56
63
 
57
64
private:
58
65
  std::vector< std::vector< float > > _outputChannels;
60
67
 
61
68
  RtAudioMembers* _rtAudio;
62
69
 
63
 
  unsigned long _bufferSize;
64
 
  unsigned long _sampleRate;
65
 
 
66
 
  unsigned short _deviceCount;
67
 
 
68
70
  DspMutex _buffersMutex;
69
71
  DspMutex _syncMutex;
70
72
  DspWaitCondition _waitCondt;
72
74
  bool _gotWaitReady;
73
75
  bool _gotSyncReady;
74
76
 
75
 
  bool _streamStop;
76
 
 
77
 
  unsigned short _currentDevice;
 
77
  void _SetIsStreaming( bool isStreaming );
78
78
 
79
79
  void _WaitForBuffer();
80
80
  void _SyncBuffer();