Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 10 additions & 18 deletions RtAudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -548,45 +548,43 @@ RtAudio::Api RtAudio :: getCompiledApiByDisplayName( const std::string &name )

void RtAudio :: openRtApi( RtAudio::Api api )
{
if ( rtapi_ )
delete rtapi_;
rtapi_ = 0;
rtapi_.reset();

#if defined(__UNIX_JACK__)
if ( api == UNIX_JACK )
rtapi_ = new RtApiJack();
rtapi_.reset(new RtApiJack());
#endif
#if defined(__LINUX_ALSA__)
if ( api == LINUX_ALSA )
rtapi_ = new RtApiAlsa();
rtapi_.reset(new RtApiAlsa());
#endif
#if defined(__LINUX_PULSE__)
if ( api == LINUX_PULSE )
rtapi_ = new RtApiPulse();
rtapi_.reset(new RtApiPulse());
#endif
#if defined(__LINUX_OSS__)
if ( api == LINUX_OSS )
rtapi_ = new RtApiOss();
rtapi_.reset(new RtApiOss());
#endif
#if defined(__WINDOWS_ASIO__)
if ( api == WINDOWS_ASIO )
rtapi_ = new RtApiAsio();
rtapi_.reset(new RtApiAsio());
#endif
#if defined(__WINDOWS_WASAPI__)
if ( api == WINDOWS_WASAPI )
rtapi_ = new RtApiWasapi();
rtapi_.reset(new RtApiWasapi());
#endif
#if defined(__WINDOWS_DS__)
if ( api == WINDOWS_DS )
rtapi_ = new RtApiDs();
rtapi_.reset(new RtApiDs());
#endif
#if defined(__MACOSX_CORE__)
if ( api == MACOSX_CORE )
rtapi_ = new RtApiCore();
rtapi_.reset(new RtApiCore());
#endif
#if defined(__RTAUDIO_DUMMY__)
if ( api == RTAUDIO_DUMMY )
rtapi_ = new RtApiDummy();
rtapi_.reset(new RtApiDummy());
#endif
}

Expand Down Expand Up @@ -640,12 +638,6 @@ RtAudio :: RtAudio( RtAudio::Api api, RtAudioErrorCallback&& errorCallback )
abort();
}

RtAudio :: ~RtAudio()
{
if ( rtapi_ )
delete rtapi_;
}

RtAudioErrorType RtAudio :: openStream( RtAudio::StreamParameters *outputParameters,
RtAudio::StreamParameters *inputParameters,
RtAudioFormat format, unsigned int sampleRate,
Expand Down
5 changes: 3 additions & 2 deletions RtAudio.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
#include <vector>
#include <iostream>
#include <functional>
#include <memory>

/*! \typedef typedef unsigned long RtAudioFormat;
\brief RtAudio data format type.
Expand Down Expand Up @@ -438,7 +439,7 @@ class RTAUDIO_DLL_PUBLIC RtAudio
If a stream is running or open, it will be stopped and closed
automatically.
*/
~RtAudio();
~RtAudio() { }

//! Returns the audio API specifier for the current instance of RtAudio.
RtAudio::Api getCurrentApi( void );
Expand Down Expand Up @@ -644,7 +645,7 @@ class RTAUDIO_DLL_PUBLIC RtAudio
protected:

void openRtApi( RtAudio::Api api );
RtApi *rtapi_;
std::shared_ptr<RtApi> rtapi_;
};

// Operating system dependent thread functionality.
Expand Down
Loading