reference

This documentation is automatically generated from the openFrameworks source code using doxygen and refers to the most recent release, version 0.12.0.

ofSoundStream.h
Go to the documentation of this file.
1#pragma once
2
3#include "ofBaseApp.h"
4#include "ofSoundBaseTypes.h"
5#include "ofConstants.h"
6#include <climits>
7#include <functional>
8
10
19OF_DEPRECATED_MSG("Use an ofSoundStreamSettings object instead of directly passing the parameters",
20 void ofSoundStreamSetup(int nOutputChannels, int nInputChannels, ofBaseApp * appPtr = nullptr));
21
29OF_DEPRECATED_MSG("Use an ofSoundStreamSettings object instead of directly passing the parameters",
30 void ofSoundStreamSetup(int nOutputChannels, int nInputChannels, int sampleRate, int bufferSize, int nBuffers));
31
41OF_DEPRECATED_MSG("Use an ofSoundStreamSettings object instead of directly passing the parameters",
42 void ofSoundStreamSetup(int nOutputChannels, int nInputChannels, ofBaseApp * appPtr, int sampleRate, int bufferSize, int nBuffers));
43
45
48
51
54
57std::vector<ofSoundDevice> ofSoundStreamListDevices();
58
83public:
85
86 void setSoundStream(std::shared_ptr<ofBaseSoundStream> soundStreamPtr);
87 std::shared_ptr<ofBaseSoundStream> getSoundStream();
88
90 void printDeviceList() const;
91
93 std::vector<ofSoundDevice> getDeviceList(ofSoundDevice::Api api = ofSoundDevice::Api::DEFAULT) const;
94
96 std::vector<ofSoundDevice> getMatchingDevices(const std::string& name, unsigned int inChannels = UINT_MAX, unsigned int outChannels = UINT_MAX, ofSoundDevice::Api api = ofSoundDevice::Api::DEFAULT) const;
97
99 OF_DEPRECATED_MSG("Use an ofSoundStreamSettings object instead of directly passing the parameters",
100 void setDeviceID(int deviceID));
101
103 OF_DEPRECATED_MSG("Use an ofSoundStreamSettings object instead of directly passing the parameters",
104 void setDevice(const ofSoundDevice& device));
105
106 bool setup(const ofSoundStreamSettings & settings);
107
118 OF_DEPRECATED_MSG("Use an ofSoundStreamSettings object instead of directly passing the parameters",
119 bool setup(ofBaseApp * app, int outChannels, int inChannels, int sampleRate, int bufferSize, int nBuffers));
120
130 OF_DEPRECATED_MSG("Use an ofSoundStreamSettings object instead of directly passing the parameters",
131 bool setup(int outChannels, int inChannels, int sampleRate, int bufferSize, int nBuffers));
132
134 void setInput(ofBaseSoundInput * soundInput);
135
137 void setInput(ofBaseSoundInput &soundInput);
138
140 void setOutput(ofBaseSoundOutput * soundOutput);
141
143 void setOutput(ofBaseSoundOutput &soundOutput);
144
146 void start();
147
149 void stop();
150
152 void close();
153
163 uint64_t getTickCount() const;
164
167 int getNumInputChannels() const;
168
171 int getNumOutputChannels() const;
172
176 int getSampleRate() const;
177
180 int getBufferSize() const;
181
183 OF_DEPRECATED_MSG("Use printDeviceList instead", std::vector<ofSoundDevice> listDevices() const);
184
185protected:
186 std::shared_ptr<ofBaseSoundStream> soundStream;
187 int tmpDeviceId = -1;
188
189};
190
Definition ofBaseApp.h:14
A base class representing a sound input stream.
Definition ofSoundBaseTypes.h:9
A base class representing a sound output stream.
Definition ofSoundBaseTypes.h:33
Represents information about a sound device on the system.
Definition ofSoundBaseTypes.h:57
Api
Definition ofSoundBaseTypes.h:59
@ DEFAULT
Definition ofSoundBaseTypes.h:61
Gives access to audio input and output devices.
Definition ofSoundStream.h:82
void printDeviceList() const
Prints a list of available audio devices to the console.
Definition ofSoundStream.cpp:197
uint64_t getTickCount() const
Queries the number of "ticks" passed since the stream started.
Definition ofSoundStream.cpp:319
OF_DEPRECATED_MSG("Use an ofSoundStreamSettings object instead of directly passing the parameters", bool setup(ofBaseApp *app, int outChannels, int inChannels, int sampleRate, int bufferSize, int nBuffers))
std::shared_ptr< ofBaseSoundStream > soundStream
Definition ofSoundStream.h:186
ofSoundStream()
Definition ofSoundStream.cpp:164
OF_DEPRECATED_MSG("Use an ofSoundStreamSettings object instead of directly passing the parameters", void setDeviceID(int deviceID))
sets the device represented by the stream, see ofSoundStream::getDeviceList().
void close()
stops the stream and cleans up its resources.
Definition ofSoundStream.cpp:312
int tmpDeviceId
Definition ofSoundStream.h:187
int getNumInputChannels() const
Queries the stream's number of input channels.
Definition ofSoundStream.cpp:327
OF_DEPRECATED_MSG("Use an ofSoundStreamSettings object instead of directly passing the parameters", void setDevice(const ofSoundDevice &device))
sets the device represented by the stream, see ofSoundStream::getDeviceList().
void stop()
Stops the stream.
Definition ofSoundStream.cpp:305
OF_DEPRECATED_MSG("Use printDeviceList instead", std::vector< ofSoundDevice > listDevices() const)
Retrieves a list of available audio devices and prints device descriptions to the console.
void start()
Starts a stream (note that setup() will start the stream on its own).
Definition ofSoundStream.cpp:298
int getBufferSize() const
Queries the stream's buffer size.
Definition ofSoundStream.cpp:351
int getNumOutputChannels() const
Queries the stream's number of output channels.
Definition ofSoundStream.cpp:335
std::shared_ptr< ofBaseSoundStream > getSoundStream()
Definition ofSoundStream.cpp:176
bool setup(const ofSoundStreamSettings &settings)
Definition ofSoundStream.cpp:218
void setSoundStream(std::shared_ptr< ofBaseSoundStream > soundStreamPtr)
Definition ofSoundStream.cpp:171
int getSampleRate() const
Queries the stream's sample rate.
Definition ofSoundStream.cpp:343
std::vector< ofSoundDevice > getMatchingDevices(const std::string &name, unsigned int inChannels=UINT_MAX, unsigned int outChannels=UINT_MAX, ofSoundDevice::Api api=ofSoundDevice::Api::DEFAULT) const
Get all devices which match the arguments (name can be a partial match)
Definition ofSoundStream.cpp:359
void setInput(ofBaseSoundInput *soundInput)
Sets the object which will have audioIn() called when the device receives audio.
Definition ofSoundStream.cpp:274
void setOutput(ofBaseSoundOutput *soundOutput)
Sets the object which will have audioOut() called when the device requests audio.
Definition ofSoundStream.cpp:286
std::vector< ofSoundDevice > getDeviceList(ofSoundDevice::Api api=ofSoundDevice::Api::DEFAULT) const
Retrieves a list of available audio devices.
Definition ofSoundStream.cpp:181
OF_DEPRECATED_MSG("Use an ofSoundStreamSettings object instead of directly passing the parameters", bool setup(int outChannels, int inChannels, int sampleRate, int bufferSize, int nBuffers))
Definition ofSoundBaseTypes.h:99
size_t sampleRate
Definition ofSoundBaseTypes.h:102
size_t bufferSize
Definition ofSoundBaseTypes.h:103
map< string, int > device
Definition ofAppEGLWindow.cpp:36
#define OF_DEPRECATED_MSG(message,...)
Definition ofConstants.h:78
void ofSoundStreamStop()
Stops the sound stream (audioIn() / audioOut() will stop being called)
Definition ofSoundStream.cpp:142
std::vector< ofSoundDevice > ofSoundStreamListDevices()
Prints a list of all available audio devices.
Definition ofSoundStream.cpp:157
void ofSoundStreamSetup(ofSoundStreamSettings &settings)
Definition ofSoundStream.cpp:137
void ofSoundStreamClose()
Stops the sound stream and also cleans up the stream's resources.
Definition ofSoundStream.cpp:152
void ofSoundStreamStart()
Starts the sound stream (audioIn() / audioOut() will start being called)
Definition ofSoundStream.cpp:147