summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/sound.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/emu/sound.h')
-rw-r--r--src/emu/sound.h32
1 files changed, 26 insertions, 6 deletions
diff --git a/src/emu/sound.h b/src/emu/sound.h
index 8039948362b..57c96683f0a 100644
--- a/src/emu/sound.h
+++ b/src/emu/sound.h
@@ -1,5 +1,5 @@
// license:BSD-3-Clause
-// copyright-holders:Aaron Giles
+// copyright-holders:O. Galibert, Aaron Giles
/***************************************************************************
sound.h
@@ -35,7 +35,7 @@
For example, if you have a 10Hz clock, and call stream.update() at
t=0.91, it will compute 10 samples (for clock edges 0.0, 0.1, 0.2,
..., 0.7, 0.8, and 0.9). And then if you ask the stream what its
- current end time is (via stream.sample_time()), it will say t=1.0,
+ current end time is (via stream.end_time()), it will say t=1.0,
which is in the future, because it knows it will hold that last
sample until 1.0s.
@@ -210,11 +210,9 @@ public:
// sample id and timing of the first and last sample of the current update block, and first of the next sample block
u64 start_index() const { return m_output_buffer.write_sample(); }
- u64 end_index() const { return m_output_buffer.write_sample() + samples() - 1; }
- u64 sample_index() const { return m_output_buffer.write_sample() + samples(); }
+ u64 end_index() const { return m_output_buffer.write_sample() + samples(); }
attotime start_time() const { return sample_to_time(start_index()); }
attotime end_time() const { return sample_to_time(end_index()); }
- attotime sample_time() const { return sample_to_time(sample_index()); }
// convert from absolute sample index to time
attotime sample_to_time(u64 index) const;
@@ -379,6 +377,11 @@ class sound_manager
public:
using sample_t = sound_stream::sample_t;
+ enum {
+ RESAMPLER_LOFI,
+ RESAMPLER_HQ
+ };
+
struct mapping {
struct node_mapping {
u32 m_node;
@@ -465,6 +468,18 @@ public:
void mapping_update();
+ const char *resampler_type_names(u32 type) const;
+
+ u32 resampler_type() const { return m_resampler_type; }
+ double resampler_hq_latency() const { return m_resampler_hq_latency; }
+ u32 resampler_hq_length() const { return m_resampler_hq_length; }
+ u32 resampler_hq_phases() const { return m_resampler_hq_phases; }
+
+ void set_resampler_type(u32 type);
+ void set_resampler_hq_latency(double latency);
+ void set_resampler_hq_length(u32 length);
+ void set_resampler_hq_phases(u32 phases);
+
private:
struct effect_step {
std::unique_ptr<audio_effect> m_effect;
@@ -583,7 +598,7 @@ private:
void update_osd_streams();
void update_osd_input();
void speakers_update(attotime endtime);
-
+ void rebuild_all_resamplers();
void run_effects();
u64 rate_and_time_to_index(attotime time, u32 sample_rate) const;
@@ -642,6 +657,11 @@ private:
std::vector<std::unique_ptr<sound_stream>> m_stream_list; // list of streams
std::vector<sound_stream *> m_ordered_streams; // Streams in update order
u32 m_outputs_count;
+
+ // resampler data
+ u32 m_resampler_type;
+ double m_resampler_hq_latency;
+ u32 m_resampler_hq_length, m_resampler_hq_phases;
};