summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/modules/sound/pa_sound.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/osd/modules/sound/pa_sound.cpp')
-rw-r--r--src/osd/modules/sound/pa_sound.cpp31
1 files changed, 8 insertions, 23 deletions
diff --git a/src/osd/modules/sound/pa_sound.cpp b/src/osd/modules/sound/pa_sound.cpp
index d5bb96a25af..68200a9c3f1 100644
--- a/src/osd/modules/sound/pa_sound.cpp
+++ b/src/osd/modules/sound/pa_sound.cpp
@@ -52,8 +52,7 @@ public:
// sound_module
- virtual void update_audio_stream(bool is_throttled, const s16 *buffer, int samples_this_frame) override;
- virtual void set_mastervolume(int attenuation) override;
+ virtual void stream_sink_update(uint32_t, const s16 *buffer, int samples_this_frame) override;
private:
// Lock free SPSC ring buffer
@@ -80,14 +79,14 @@ private:
writepos.store((writepos + n) % size);
}
- int write(const T* src, int n, int attenuation) {
+ int write(const T* src, int n) {
n = std::min<int>(n, size - reserve - count());
if (writepos + n > size) {
- att_memcpy(buf + writepos, src, sizeof(T) * (size - writepos), attenuation);
- att_memcpy(buf, src + (size - writepos), sizeof(T) * (n - (size - writepos)), attenuation);
+ memcpy(buf + writepos, src, sizeof(T) * (size - writepos));
+ memcpy(buf, src + (size - writepos), sizeof(T) * (n - (size - writepos)));
} else {
- att_memcpy(buf + writepos, src, sizeof(T) * n, attenuation);
+ memcpy(buf + writepos, src, sizeof(T) * n);
}
increment_writepos(n);
@@ -128,13 +127,6 @@ private:
return n;
}
-
- void att_memcpy(T* dest, const T* data, int n, int attenuation) {
- int level = powf(10.0, attenuation / 20.0) * 32768;
- n /= sizeof(T);
- while (n--)
- *dest++ = (*data++ * level) >> 15;
- }
};
enum
@@ -159,7 +151,6 @@ private:
int m_sample_rate;
int m_audio_latency;
- int m_attenuation;
audio_buffer<s16>* m_ab;
@@ -193,7 +184,6 @@ int sound_pa::init(osd_interface &osd, osd_options const &options)
unsigned long frames_per_callback = paFramesPerBufferUnspecified;
double callback_interval;
- m_attenuation = options.volume();
m_underflows = 0;
m_overflows = 0;
m_has_overflowed = false;
@@ -389,7 +379,7 @@ int sound_pa::callback(s16* output_buffer, size_t number_of_samples)
m_ab->read(output_buffer, buf_ct);
std::memset(output_buffer + buf_ct, 0, (number_of_samples - buf_ct) * sizeof(s16));
- // if update_audio_stream has been called, note the underflow
+ // if stream_sink_update has been called, note the underflow
if (m_osd_ticks)
m_has_underflowed = true;
@@ -399,7 +389,7 @@ int sound_pa::callback(s16* output_buffer, size_t number_of_samples)
return paContinue;
}
-void sound_pa::update_audio_stream(bool is_throttled, const s16 *buffer, int samples_this_frame)
+void sound_pa::stream_sink_update(uint32_t, const s16 *buffer, int samples_this_frame)
{
if (!m_sample_rate)
return;
@@ -423,17 +413,12 @@ void sound_pa::update_audio_stream(bool is_throttled, const s16 *buffer, int sam
m_has_overflowed = false;
}
- m_ab->write(buffer, samples_this_frame * 2, m_attenuation);
+ m_ab->write(buffer, samples_this_frame * 2);
// for determining buffer overflows, take the sample here instead of in the callback
m_osd_ticks = osd_ticks();
}
-void sound_pa::set_mastervolume(int attenuation)
-{
- m_attenuation = attenuation;
-}
-
void sound_pa::exit()
{
if (!m_sample_rate)