Move formerly Gtk sound drivers to common directory.
This commit is contained in:
parent
8c5b6d012e
commit
81efc82f88
@ -4,8 +4,8 @@
|
|||||||
For further information, consult the LICENSE file in the root directory.
|
For further information, consult the LICENSE file in the root directory.
|
||||||
\*****************************************************************************/
|
\*****************************************************************************/
|
||||||
|
|
||||||
#ifndef __S9X_SOUND_DRIVER_H
|
#ifndef __S9X_SOUND_DRIVER_HPP
|
||||||
#define __S9X_SOUND_DRIVER_H
|
#define __S9X_SOUND_DRIVER_HPP
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
@ -26,4 +26,4 @@ class S9xSoundDriver
|
|||||||
virtual void stop() = 0;
|
virtual void stop() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __GTK_SOUND_DRIVER_H */
|
#endif /* __S9X_SOUND_DRIVER_HPP */
|
@ -4,7 +4,7 @@
|
|||||||
For further information, consult the LICENSE file in the root directory.
|
For further information, consult the LICENSE file in the root directory.
|
||||||
\*****************************************************************************/
|
\*****************************************************************************/
|
||||||
|
|
||||||
#include "gtk_sound_driver_alsa.h"
|
#include "s9x_sound_driver_alsa.hpp"
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
@ -4,11 +4,10 @@
|
|||||||
For further information, consult the LICENSE file in the root directory.
|
For further information, consult the LICENSE file in the root directory.
|
||||||
\*****************************************************************************/
|
\*****************************************************************************/
|
||||||
|
|
||||||
#ifndef __GTK_SOUND_DRIVER_ALSA_H
|
#ifndef __S9X_SOUND_DRIVER_ALSA_HPP
|
||||||
#define __GTK_SOUND_DRIVER_ALSA_H
|
#define __S9X_SOUND_DRIVER_ALSA_HPP
|
||||||
|
|
||||||
#include "gtk_sound.h"
|
#include "s9x_sound_driver.hpp"
|
||||||
#include "gtk_sound_driver.h"
|
|
||||||
#include "alsa/asoundlib.h"
|
#include "alsa/asoundlib.h"
|
||||||
|
|
||||||
class S9xAlsaSoundDriver : public S9xSoundDriver
|
class S9xAlsaSoundDriver : public S9xSoundDriver
|
||||||
@ -29,4 +28,4 @@ class S9xAlsaSoundDriver : public S9xSoundDriver
|
|||||||
int output_buffer_size_bytes;
|
int output_buffer_size_bytes;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __GTK_SOUND_DRIVER_ALSA_H */
|
#endif /* __S9X_SOUND_DRIVER_ALSA_HPP */
|
@ -4,13 +4,29 @@
|
|||||||
For further information, consult the LICENSE file in the root directory.
|
For further information, consult the LICENSE file in the root directory.
|
||||||
\*****************************************************************************/
|
\*****************************************************************************/
|
||||||
|
|
||||||
#include "gtk_sound_driver_oss.h"
|
#include "s9x_sound_driver_oss.hpp"
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/soundcard.h>
|
#include <sys/soundcard.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <cstdio>
|
||||||
|
|
||||||
|
static inline int log2(int num)
|
||||||
|
{
|
||||||
|
int power;
|
||||||
|
|
||||||
|
if (num < 1)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
for (power = 0; num > 1; power++)
|
||||||
|
{
|
||||||
|
num >>= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return power;
|
||||||
|
}
|
||||||
|
|
||||||
S9xOSSSoundDriver::S9xOSSSoundDriver()
|
S9xOSSSoundDriver::S9xOSSSoundDriver()
|
||||||
{
|
{
|
||||||
@ -106,7 +122,7 @@ bool S9xOSSSoundDriver::open_device(int playback_rate, int buffer_size_ms)
|
|||||||
|
|
||||||
/* OSS requires a power-of-two buffer size, first 16 bits are the number
|
/* OSS requires a power-of-two buffer size, first 16 bits are the number
|
||||||
* of fragments to generate, second 16 are the respective power-of-two. */
|
* of fragments to generate, second 16 are the respective power-of-two. */
|
||||||
temp = (4 << 16) | (S9xSoundBase2log(output_buffer_size_bytes / 4));
|
temp = (4 << 16) | (log2(output_buffer_size_bytes / 4));
|
||||||
|
|
||||||
if (ioctl(filedes, SNDCTL_DSP_SETFRAGMENT, &temp) < 0)
|
if (ioctl(filedes, SNDCTL_DSP_SETFRAGMENT, &temp) < 0)
|
||||||
goto close_fail;
|
goto close_fail;
|
@ -4,11 +4,10 @@
|
|||||||
For further information, consult the LICENSE file in the root directory.
|
For further information, consult the LICENSE file in the root directory.
|
||||||
\*****************************************************************************/
|
\*****************************************************************************/
|
||||||
|
|
||||||
#ifndef __GTK_SOUND_DRIVER_OSS_H
|
#ifndef __S9X_SOUND_DRIVER_OSS_HPP
|
||||||
#define __GTK_SOUND_DRIVER_OSS_H
|
#define __S9X_SOUND_DRIVER_OSS_HPP
|
||||||
|
|
||||||
#include "gtk_sound.h"
|
#include "s9x_sound_driver.hpp"
|
||||||
#include "gtk_sound_driver.h"
|
|
||||||
|
|
||||||
class S9xOSSSoundDriver : public S9xSoundDriver
|
class S9xOSSSoundDriver : public S9xSoundDriver
|
||||||
{
|
{
|
||||||
@ -28,4 +27,4 @@ class S9xOSSSoundDriver : public S9xSoundDriver
|
|||||||
int output_buffer_size_bytes;
|
int output_buffer_size_bytes;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __GTK_SOUND_DRIVER_OSS_H */
|
#endif /* __S9X_SOUND_DRIVER_OSS_HPP */
|
@ -4,8 +4,11 @@
|
|||||||
For further information, consult the LICENSE file in the root directory.
|
For further information, consult the LICENSE file in the root directory.
|
||||||
\*****************************************************************************/
|
\*****************************************************************************/
|
||||||
|
|
||||||
#include "gtk_sound_driver_portaudio.h"
|
#include "s9x_sound_driver_portaudio.hpp"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <cstdio>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
S9xPortAudioSoundDriver::S9xPortAudioSoundDriver()
|
S9xPortAudioSoundDriver::S9xPortAudioSoundDriver()
|
||||||
{
|
{
|
@ -4,14 +4,13 @@
|
|||||||
For further information, consult the LICENSE file in the root directory.
|
For further information, consult the LICENSE file in the root directory.
|
||||||
\*****************************************************************************/
|
\*****************************************************************************/
|
||||||
|
|
||||||
#ifndef __GTK_SOUND_DRIVER_PORTAUDIO_H
|
#ifndef __S9X_SOUND_DRIVER_PORTAUDIO_HPP
|
||||||
#define __GTK_SOUND_DRIVER_PORTAUDIO_H
|
#define __S9X_SOUND_DRIVER_PORTAUDIO_HPP
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <portaudio.h>
|
#include <portaudio.h>
|
||||||
|
|
||||||
#include "gtk_sound.h"
|
#include "s9x_sound_driver.hpp"
|
||||||
#include "gtk_sound_driver.h"
|
|
||||||
|
|
||||||
class S9xPortAudioSoundDriver : public S9xSoundDriver
|
class S9xPortAudioSoundDriver : public S9xSoundDriver
|
||||||
{
|
{
|
||||||
@ -32,4 +31,4 @@ class S9xPortAudioSoundDriver : public S9xSoundDriver
|
|||||||
int output_buffer_size;
|
int output_buffer_size;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __GTK_SOUND_DRIVER_PORTAUDIO_H */
|
#endif /* __S9X_SOUND_DRIVER_PORTAUDIO_HPP */
|
@ -4,9 +4,10 @@
|
|||||||
For further information, consult the LICENSE file in the root directory.
|
For further information, consult the LICENSE file in the root directory.
|
||||||
\*****************************************************************************/
|
\*****************************************************************************/
|
||||||
|
|
||||||
#include "gtk_sound_driver_pulse.h"
|
#include "s9x_sound_driver_pulse.hpp"
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <cstdio>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
@ -4,11 +4,10 @@
|
|||||||
For further information, consult the LICENSE file in the root directory.
|
For further information, consult the LICENSE file in the root directory.
|
||||||
\*****************************************************************************/
|
\*****************************************************************************/
|
||||||
|
|
||||||
#ifndef __GTK_SOUND_DRIVER_PULSE_H
|
#ifndef __S9X_SOUND_DRIVER_PULSE_HPP
|
||||||
#define __GTK_SOUND_DRIVER_PULSE_H
|
#define __S9X_SOUND_DRIVER_PULSE_HPP
|
||||||
|
|
||||||
#include "gtk_sound.h"
|
#include "s9x_sound_driver.hpp"
|
||||||
#include "gtk_sound_driver.h"
|
|
||||||
#include "pulse/pulseaudio.h"
|
#include "pulse/pulseaudio.h"
|
||||||
|
|
||||||
class S9xPulseSoundDriver : public S9xSoundDriver
|
class S9xPulseSoundDriver : public S9xSoundDriver
|
||||||
@ -35,4 +34,4 @@ class S9xPulseSoundDriver : public S9xSoundDriver
|
|||||||
int buffer_size;
|
int buffer_size;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __GTK_SOUND_DRIVER_PULSE_H */
|
#endif /* __S9X_SOUND_DRIVER_PULSE_HPP */
|
@ -4,7 +4,7 @@
|
|||||||
For further information, consult the LICENSE file in the root directory.
|
For further information, consult the LICENSE file in the root directory.
|
||||||
\*****************************************************************************/
|
\*****************************************************************************/
|
||||||
|
|
||||||
#include "gtk_sound_driver_sdl.h"
|
#include "s9x_sound_driver_sdl.hpp"
|
||||||
#include "SDL_audio.h"
|
#include "SDL_audio.h"
|
||||||
|
|
||||||
void S9xSDLSoundDriver::write_samples(int16_t *data, int samples)
|
void S9xSDLSoundDriver::write_samples(int16_t *data, int samples)
|
@ -4,16 +4,15 @@
|
|||||||
For further information, consult the LICENSE file in the root directory.
|
For further information, consult the LICENSE file in the root directory.
|
||||||
\*****************************************************************************/
|
\*****************************************************************************/
|
||||||
|
|
||||||
#ifndef __GTK_SOUND_DRIVER_SDL_H
|
#ifndef __S9X_SOUND_DRIVER_SDL_HPP
|
||||||
#define __GTK_SOUND_DRIVER_SDL_H
|
#define __S9X_SOUND_DRIVER_SDL_HPP
|
||||||
|
|
||||||
#include "SDL.h"
|
#include "SDL.h"
|
||||||
// SDL.h may include altivec.h which redefines vector and bool
|
// SDL.h may include altivec.h which redefines vector and bool
|
||||||
#undef vector
|
#undef vector
|
||||||
#undef bool
|
#undef bool
|
||||||
|
|
||||||
#include "gtk_sound.h"
|
#include "s9x_sound_driver.hpp"
|
||||||
#include "gtk_sound_driver.h"
|
|
||||||
#include "../../apu/resampler.h"
|
#include "../../apu/resampler.h"
|
||||||
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
@ -41,4 +40,4 @@ class S9xSDLSoundDriver : public S9xSoundDriver
|
|||||||
int16_t temp[512];
|
int16_t temp[512];
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __GTK_SOUND_DRIVER_SDL_H */
|
#endif /* __S9X_SOUND_DRIVER_SDL_HPP */
|
@ -175,7 +175,7 @@ endif()
|
|||||||
if(USE_PULSEAUDIO)
|
if(USE_PULSEAUDIO)
|
||||||
pkg_check_modules(PULSEAUDIO REQUIRED libpulse)
|
pkg_check_modules(PULSEAUDIO REQUIRED libpulse)
|
||||||
list(APPEND DEFINES "USE_PULSEAUDIO")
|
list(APPEND DEFINES "USE_PULSEAUDIO")
|
||||||
list(APPEND SOURCES src/gtk_sound_driver_pulse.cpp)
|
list(APPEND SOURCES ../common/audio/s9x_sound_driver_pulse.cpp)
|
||||||
list(APPEND ARGS ${PULSEAUDIO_CFLAGS})
|
list(APPEND ARGS ${PULSEAUDIO_CFLAGS})
|
||||||
list(APPEND LIBS ${PULSEAUDIO_LIBRARIES})
|
list(APPEND LIBS ${PULSEAUDIO_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
@ -183,7 +183,7 @@ endif()
|
|||||||
if(USE_PORTAUDIO)
|
if(USE_PORTAUDIO)
|
||||||
pkg_check_modules(PORTAUDIO REQUIRED portaudio-2.0)
|
pkg_check_modules(PORTAUDIO REQUIRED portaudio-2.0)
|
||||||
list(APPEND DEFINES "USE_PORTAUDIO")
|
list(APPEND DEFINES "USE_PORTAUDIO")
|
||||||
list(APPEND SOURCES src/gtk_sound_driver_portaudio.cpp)
|
list(APPEND SOURCES ../common/audio/s9x_sound_driver_portaudio.cpp)
|
||||||
list(APPEND ARGS ${PORTAUDIO_CFLAGS})
|
list(APPEND ARGS ${PORTAUDIO_CFLAGS})
|
||||||
list(APPEND LIBS ${PORTAUDIO_LIBRARIES})
|
list(APPEND LIBS ${PORTAUDIO_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
@ -191,7 +191,7 @@ endif()
|
|||||||
if(USE_ALSA)
|
if(USE_ALSA)
|
||||||
pkg_check_modules(ALSA REQUIRED alsa)
|
pkg_check_modules(ALSA REQUIRED alsa)
|
||||||
list(APPEND DEFINES "USE_ALSA")
|
list(APPEND DEFINES "USE_ALSA")
|
||||||
list(APPEND SOURCES src/gtk_sound_driver_alsa.cpp)
|
list(APPEND SOURCES ../common/audio/s9x_sound_driver_alsa.cpp)
|
||||||
list(APPEND ARGS ${ALSA_CFLAGS})
|
list(APPEND ARGS ${ALSA_CFLAGS})
|
||||||
list(APPEND LIBS ${ALSA_LIBRARIES})
|
list(APPEND LIBS ${ALSA_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
@ -199,7 +199,7 @@ endif()
|
|||||||
if(USE_OSS)
|
if(USE_OSS)
|
||||||
CHECK_INCLUDE_FILE("sys/soundcard.h" OSS)
|
CHECK_INCLUDE_FILE("sys/soundcard.h" OSS)
|
||||||
if(OSS)
|
if(OSS)
|
||||||
list(APPEND SOURCES src/gtk_sound_driver_oss.cpp)
|
list(APPEND SOURCES ../common/audio/s9x_sound_driver_oss.cpp)
|
||||||
list(APPEND DEFINES "USE_OSS")
|
list(APPEND DEFINES "USE_OSS")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
@ -238,7 +238,7 @@ if(DANGEROUS_HACKS)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
list(APPEND SOURCES
|
list(APPEND SOURCES
|
||||||
src/gtk_sound_driver.h
|
../common/audio/s9x_sound_driver.hpp
|
||||||
../filter/2xsai.cpp
|
../filter/2xsai.cpp
|
||||||
../filter/2xsai.h
|
../filter/2xsai.h
|
||||||
../filter/epx.cpp
|
../filter/epx.cpp
|
||||||
@ -279,8 +279,8 @@ list(APPEND SOURCES
|
|||||||
../filter/snes_ntsc_impl.h
|
../filter/snes_ntsc_impl.h
|
||||||
../filter/snes_ntsc.c
|
../filter/snes_ntsc.c
|
||||||
src/gtk_compat.h
|
src/gtk_compat.h
|
||||||
src/gtk_sound_driver_sdl.h
|
../common/audio/s9x_sound_driver_sdl.hpp
|
||||||
src/gtk_sound_driver_sdl.cpp
|
../common/audio/s9x_sound_driver_sdl.cpp
|
||||||
../fxinst.cpp
|
../fxinst.cpp
|
||||||
../fxemu.cpp
|
../fxemu.cpp
|
||||||
../fxdbg.cpp
|
../fxdbg.cpp
|
||||||
|
@ -9,22 +9,22 @@
|
|||||||
|
|
||||||
#include "gtk_s9x.h"
|
#include "gtk_s9x.h"
|
||||||
#include "gtk_sound.h"
|
#include "gtk_sound.h"
|
||||||
#include "gtk_sound_driver.h"
|
#include "common/audio/s9x_sound_driver.hpp"
|
||||||
#include "snes9x.h"
|
#include "snes9x.h"
|
||||||
#include "apu/apu.h"
|
#include "apu/apu.h"
|
||||||
|
|
||||||
#ifdef USE_PORTAUDIO
|
#ifdef USE_PORTAUDIO
|
||||||
#include "gtk_sound_driver_portaudio.h"
|
#include "common/audio/s9x_sound_driver_portaudio.hpp"
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_OSS
|
#ifdef USE_OSS
|
||||||
#include "gtk_sound_driver_oss.h"
|
#include "common/audio/s9x_sound_driver_oss.hpp"
|
||||||
#endif
|
#endif
|
||||||
#include "gtk_sound_driver_sdl.h"
|
#include "common/audio/s9x_sound_driver_sdl.hpp"
|
||||||
#ifdef USE_ALSA
|
#ifdef USE_ALSA
|
||||||
#include "gtk_sound_driver_alsa.h"
|
#include "common/audio/s9x_sound_driver_alsa.hpp"
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_PULSEAUDIO
|
#ifdef USE_PULSEAUDIO
|
||||||
#include "gtk_sound_driver_pulse.h"
|
#include "common/audio/s9x_sound_driver_pulse.hpp"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int playback_rates[8] =
|
static int playback_rates[8] =
|
||||||
|
Loading…
Reference in New Issue
Block a user