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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ RtAudio is a set of C++ classes that provides a common API (Application Programm

RtAudio incorporates the concept of audio streams, which represent audio output (playback) and/or input (recording). Available audio devices and their capabilities can be enumerated and then specified when opening a stream. Where applicable, multiple API support can be compiled and a particular API specified when creating an RtAudio instance. See the \ref apinotes section for information specific to each of the supported audio APIs.

RtAudio is also offered as a module, which is enabled with `RTAUDIO_BUILD_MODULES`, and is accessed with `import rt.audio;`. Namespaces are inlined, so classes can be accessed through namespace `rt::audio` or through the global namespace (for example, `rt::audio::RtApi` and `::RtApi` are both valid).
RtAudio is also offered as a module, which is enabled with `RTAUDIO_BUILD_MODULES`, and is accessed with `import rt.audio;`. Namespaces are implicitly imported (unless disabled with `RTAUDIO_USE_NAMESPACE`), so classes can be accessed through namespace `rt::audio` or through the global namespace (for example, `rt::audio::RtApi` and `::RtApi` are both valid).

## Building

Expand Down
2 changes: 2 additions & 0 deletions RtAudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
#include <windows.h>
#endif

using namespace rt::audio;

// Static variable definitions.
const unsigned int RtApi::MAX_SAMPLE_RATES = 14;
const unsigned int RtApi::SAMPLE_RATES[] = {
Expand Down
19 changes: 7 additions & 12 deletions RtAudio.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@
#include <functional>
#include <memory>

inline namespace rt {
inline namespace audio {
namespace rt::audio {

/*! \typedef typedef unsigned long RtAudioFormat;
\brief RtAudio data format type.
Expand Down Expand Up @@ -651,7 +650,6 @@ class RTAUDIO_DLL_PUBLIC RtAudio
std::shared_ptr<RtApi> rtapi_;
};

}
}

// Operating system dependent thread functionality.
Expand All @@ -676,12 +674,10 @@ inline namespace audio {
// Using pthread library for various flavors of unix.
#include <pthread.h>

inline namespace rt {
inline namespace audio {
namespace rt::audio {
typedef pthread_t ThreadHandle;
typedef pthread_mutex_t StreamMutex;
}
}

#endif

Expand All @@ -694,8 +690,7 @@ inline namespace audio {

#endif

inline namespace rt {
inline namespace audio {
namespace rt::audio {

// This global structure type is used to pass callback information
// between the private RtAudio stream structure and global callback
Expand Down Expand Up @@ -755,7 +750,6 @@ class S24 {
};
#pragma pack(pop)

}
}

#if defined( HAVE_GETTIMEOFDAY )
Expand All @@ -764,8 +758,7 @@ class S24 {

#include <sstream>

inline namespace rt {
inline namespace audio {
namespace rt::audio {

class RTAUDIO_DLL_PUBLIC RtApi
{
Expand Down Expand Up @@ -952,11 +945,13 @@ inline void RtAudio :: setStreamTime( double time ) { return rtapi_->setStreamTi
inline void RtAudio :: setErrorCallback( RtAudioErrorCallback errorCallback ) { rtapi_->setErrorCallback( errorCallback ); }
inline void RtAudio :: showWarnings( bool value ) { rtapi_->showWarnings( value ); }

}
}

#endif

#ifndef RTAUDIO_USE_NAMESPACE
using namespace rt::audio;
#endif

// Indentation settings for Vim and Emacs
//
Expand Down
13 changes: 4 additions & 9 deletions modules/RtAudio.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,7 @@ module;

export module rt.audio;

export
#ifdef RTAUDIO_USE_NAMESPACE
inline namespace rt {
inline namespace audio {
#else
namespace rt::audio {
#endif
export namespace rt::audio {
using rt::audio::RtAudioFormat;
using rt::audio::RtAudioStreamFlags;
using rt::audio::RtAudioStreamStatus;
Expand All @@ -24,6 +18,7 @@ namespace rt::audio {
using rt::audio::CallbackInfo;
using rt::audio::S24;
}
#ifdef RTAUDIO_USE_NAMESPACE
}

#ifndef RTAUDIO_USE_NAMESPACE
using namespace rt::audio;
#endif
Loading