|
21 | 21 | #endif |
22 | 22 |
|
23 | 23 | namespace{ |
24 | | - ofSoundStream systemSoundStream; |
| 24 | + ofSoundStream &getSystemSoundStream() { |
| 25 | + static ofSoundStream _; |
| 26 | + return _; |
| 27 | + } |
25 | 28 | } |
26 | 29 |
|
27 | 30 | using std::shared_ptr; |
@@ -118,27 +121,27 @@ void ofSoundStreamSetup(int nOutputChannels, int nInputChannels, ofBaseApp * app |
118 | 121 |
|
119 | 122 | //------------------------------------------------------------ |
120 | 123 | void ofSoundStreamSetup(ofSoundStreamSettings & settings) { |
121 | | - systemSoundStream.setup(settings); |
| 124 | + getSystemSoundStream().setup(settings); |
122 | 125 | } |
123 | 126 |
|
124 | 127 | //------------------------------------------------------------ |
125 | 128 | void ofSoundStreamStop(){ |
126 | | - systemSoundStream.stop(); |
| 129 | + getSystemSoundStream().stop(); |
127 | 130 | } |
128 | 131 |
|
129 | 132 | //------------------------------------------------------------ |
130 | 133 | void ofSoundStreamStart(){ |
131 | | - systemSoundStream.start(); |
| 134 | + getSystemSoundStream().start(); |
132 | 135 | } |
133 | 136 |
|
134 | 137 | //------------------------------------------------------------ |
135 | 138 | void ofSoundStreamClose(){ |
136 | | - systemSoundStream.close(); |
| 139 | + getSystemSoundStream().close(); |
137 | 140 | } |
138 | 141 |
|
139 | 142 | //------------------------------------------------------------ |
140 | 143 | vector<ofSoundDevice> ofSoundStreamListDevices(){ |
141 | | - vector<ofSoundDevice> deviceList = systemSoundStream.getDeviceList(); |
| 144 | + vector<ofSoundDevice> deviceList = getSystemSoundStream().getDeviceList(); |
142 | 145 | ofLogNotice("ofSoundStreamListDevices") << std::endl << deviceList; |
143 | 146 | return deviceList; |
144 | 147 | } |
|
0 commit comments