Rename *OutputDevice(s) to *PlaybackDevice(s)

This commit is contained in:
Miku AuahDark
2022-05-07 11:04:28 +08:00
parent b2a6abdc0a
commit 7af537a417
8 changed files with 28 additions and 28 deletions
+1 -1
View File
@@ -78,7 +78,7 @@ bool Audio::setMixWithSystem(bool mix)
#endif #endif
} }
void Audio::setOutputDevice(const char */*name*/) void Audio::setPlaybackDevice(const char */*name*/)
{ {
throw love::Exception("Re-setting output device is not supported."); throw love::Exception("Re-setting output device is not supported.");
} }
+6 -6
View File
@@ -298,19 +298,19 @@ public:
virtual void resumeContext() = 0; virtual void resumeContext() = 0;
/** /**
* Get current output device name. * Get current playback device name.
*/ */
virtual std::string getOutputDevice() = 0; virtual std::string getPlaybackDevice() = 0;
/** /**
* Retrieve list of available output devices. * Retrieve list of available playback devices.
*/ */
virtual void getOutputDevices(std::vector<std::string> &list) = 0; virtual void getPlaybackDevices(std::vector<std::string> &list) = 0;
/** /**
* Set the output device to specified device name. * Set the current playback device to specified device name.
*/ */
virtual void setOutputDevice(const char *name); virtual void setPlaybackDevice(const char *name);
private: private:
+2 -2
View File
@@ -211,12 +211,12 @@ void Audio::resumeContext()
{ {
} }
std::string Audio::getOutputDevice() std::string Audio::getPlaybackDevice()
{ {
return ""; return "";
} }
void Audio::getOutputDevices(std::vector<std::string> &/*list*/) void Audio::getPlaybackDevices(std::vector<std::string> &/*list*/)
{ {
} }
+2 -2
View File
@@ -89,8 +89,8 @@ public:
void pauseContext(); void pauseContext();
void resumeContext(); void resumeContext();
std::string getOutputDevice(); std::string getPlaybackDevice();
void getOutputDevices(std::vector<std::string> &list); void getPlaybackDevices(std::vector<std::string> &list);
private: private:
float volume; float volume;
+4 -4
View File
@@ -328,7 +328,7 @@ void Audio::resumeContext()
alcMakeContextCurrent(context); alcMakeContextCurrent(context);
} }
std::string Audio::getOutputDevice() std::string Audio::getPlaybackDevice()
{ {
const char *dev = getDeviceSpecifier(device); const char *dev = getDeviceSpecifier(device);
@@ -338,7 +338,7 @@ std::string Audio::getOutputDevice()
return dev; return dev;
} }
void Audio::getOutputDevices(std::vector<std::string> &list) void Audio::getPlaybackDevices(std::vector<std::string> &list)
{ {
const char *devices = getDeviceSpecifier(nullptr); const char *devices = getDeviceSpecifier(nullptr);
@@ -352,7 +352,7 @@ void Audio::getOutputDevices(std::vector<std::string> &list)
} }
} }
void Audio::setOutputDevice(const char* name) void Audio::setPlaybackDevice(const char* name)
{ {
#ifndef ALC_SOFT_reopen_device #ifndef ALC_SOFT_reopen_device
typedef ALCboolean (ALC_APIENTRY*LPALCREOPENDEVICESOFT)(ALCdevice *device, typedef ALCboolean (ALC_APIENTRY*LPALCREOPENDEVICESOFT)(ALCdevice *device,
@@ -366,7 +366,7 @@ void Audio::setOutputDevice(const char* name)
{ {
// Default implementation throws exception. To make // Default implementation throws exception. To make
// error message consistent, call the base class. // error message consistent, call the base class.
love::audio::Audio::setOutputDevice(name); love::audio::Audio::setPlaybackDevice(name);
return; return;
} }
+3 -3
View File
@@ -127,9 +127,9 @@ public:
bool getEffectID(const char *name, ALuint &id); bool getEffectID(const char *name, ALuint &id);
std::string getOutputDevice(); std::string getPlaybackDevice();
void getOutputDevices(std::vector<std::string> &list); void getPlaybackDevices(std::vector<std::string> &list);
void setOutputDevice(const char *name); void setPlaybackDevice(const char *name);
private: private:
void initializeEFX(); void initializeEFX();
+9 -9
View File
@@ -543,20 +543,20 @@ int w_setMixWithSystem(lua_State *L)
return 1; return 1;
} }
int w_getOutputDevice(lua_State* L) int w_getPlaybackDevice(lua_State* L)
{ {
std::string device; std::string device;
luax_catchexcept(L, [&]() { device = instance()->getOutputDevice(); }); luax_catchexcept(L, [&]() { device = instance()->getPlaybackDevice(); });
luax_pushstring(L, device); luax_pushstring(L, device);
return 1; return 1;
} }
int w_getOutputDevices(lua_State* L) int w_getPlaybackDevices(lua_State* L)
{ {
std::vector<std::string> list; std::vector<std::string> list;
luax_catchexcept(L, [&]() { instance()->getOutputDevices(list); }); luax_catchexcept(L, [&]() { instance()->getPlaybackDevices(list); });
lua_createtable(L, 0, (int) list.size()); lua_createtable(L, 0, (int) list.size());
for (int i = 0; i < (int) list.size(); i++) for (int i = 0; i < (int) list.size(); i++)
{ {
@@ -568,13 +568,13 @@ int w_getOutputDevices(lua_State* L)
return 1; return 1;
} }
int w_setOutputDevice(lua_State* L) int w_setPlaybackDevice(lua_State* L)
{ {
const char *device = luaL_optstring(L, 1, nullptr); const char *device = luaL_optstring(L, 1, nullptr);
try try
{ {
instance()->setOutputDevice(device); instance()->setPlaybackDevice(device);
luax_pushboolean(L, true); luax_pushboolean(L, true);
return 1; return 1;
} }
@@ -620,9 +620,9 @@ static const luaL_Reg functions[] =
{ "getMaxSourceEffects", w_getMaxSourceEffects }, { "getMaxSourceEffects", w_getMaxSourceEffects },
{ "isEffectsSupported", w_isEffectsSupported }, { "isEffectsSupported", w_isEffectsSupported },
{ "setMixWithSystem", w_setMixWithSystem }, { "setMixWithSystem", w_setMixWithSystem },
{ "getOutputDevice", w_getOutputDevice }, { "getPlaybackDevice", w_getPlaybackDevice },
{ "getOutputDevices", w_getOutputDevices }, { "getPlaybackDevices", w_getPlaybackDevices },
{ "setOutputDevice", w_setOutputDevice }, { "setPlaybackDevice", w_setPlaybackDevice },
{ 0, 0 } { 0, 0 }
}; };
+1 -1
View File
@@ -131,7 +131,7 @@ function love.createhandlers()
end, end,
audiodisconnected = function (sources) audiodisconnected = function (sources)
if not love.audiodisconnected or not love.audiodisconnected(sources) then if not love.audiodisconnected or not love.audiodisconnected(sources) then
love.audio.setOutputDevice() love.audio.setPlaybackDevice()
end end
end, end,
}, { }, {