New API for sf::Thread (more flexible)
git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1685 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
7ebf2f1bbb
commit
e73d274d86
8 changed files with 263 additions and 105 deletions
|
@ -38,7 +38,7 @@ namespace sf
|
|||
/// \brief Abstract base class for capturing sound data
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
class SFML_API SoundRecorder : private Thread
|
||||
class SFML_API SoundRecorder
|
||||
{
|
||||
public :
|
||||
|
||||
|
@ -157,7 +157,7 @@ private :
|
|||
/// only when the capture is stopped.
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual void Run();
|
||||
void Record();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the new available audio samples and process them
|
||||
|
@ -180,6 +180,7 @@ private :
|
|||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
Thread myThread; ///< Thread running the background recording task
|
||||
std::vector<Int16> mySamples; ///< Buffer to store captured samples
|
||||
unsigned int mySampleRate; ///< Sample rate
|
||||
bool myIsCapturing; ///< Capturing state
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace sf
|
|||
/// \brief Abstract base class for streamed audio sources
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
class SFML_API SoundStream : public SoundSource, private Thread
|
||||
class SFML_API SoundStream : public SoundSource
|
||||
{
|
||||
public :
|
||||
|
||||
|
@ -208,7 +208,7 @@ private :
|
|||
/// only when the sound is stopped.
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual void Run();
|
||||
void Stream();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Request a new chunk of audio samples from the stream source
|
||||
|
@ -279,6 +279,7 @@ private :
|
|||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
Thread myThread; ///< Thread running the background tasks
|
||||
bool myIsStreaming; ///< Streaming state (true = playing, false = stopped)
|
||||
unsigned int myBuffers[BuffersCount]; ///< Sound buffers used to store temporary audio data
|
||||
unsigned int myChannelsCount; ///< Number of channels (1 = mono, 2 = stereo, ...)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue