Maybe fixed the glitchiness at startup even more?
This commit is contained in:
parent
dd7ccc85b9
commit
fa5c203cf8
@ -29,8 +29,10 @@ namespace audio::detail{
|
||||
std::tuple<Args...> m_args;
|
||||
|
||||
template<int... Indices>
|
||||
int operator()(const void* input, void* output, unsigned long frame_count, std::integer_sequence<int,Indices...>){
|
||||
return std::forward<Func>(m_f)(input, output, frame_count, std::get<Indices>(m_args)...);
|
||||
int operator()(const void* input, void* output, unsigned long frame_count,
|
||||
unsigned long flags, std::integer_sequence<int,Indices...>)
|
||||
{
|
||||
return std::forward<Func>(m_f)(input, output, frame_count, flags, std::get<Indices>(m_args)...);
|
||||
}
|
||||
};
|
||||
|
||||
@ -40,7 +42,7 @@ namespace audio::detail{
|
||||
callback_iface() = default;
|
||||
|
||||
virtual ~callback_iface() = default;
|
||||
virtual int operator()(const void* input, void* output, unsigned long frame_count) = 0;
|
||||
virtual int operator()(const void* input, void* output, unsigned long frame_count, unsigned long flags) = 0;
|
||||
};
|
||||
|
||||
template<typename Func, typename... Args>
|
||||
@ -52,8 +54,8 @@ namespace audio::detail{
|
||||
template<class Fn, class... Ts>
|
||||
callback_impl(Fn&& f, Ts&&... ts):
|
||||
m_ch{std::forward<Fn>(f), {std::forward<Ts>(ts)...}}{}
|
||||
int operator()(const void* input, void* output, unsigned long frame_count)override{
|
||||
return m_ch(input, output, frame_count, typename ::util::sequence_gen<sizeof...(Args)>::type{});
|
||||
int operator()(const void* input, void* output, unsigned long frame_count, unsigned long flags)override{
|
||||
return m_ch(input, output, frame_count, flags, typename ::util::sequence_gen<sizeof...(Args)>::type{});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -68,7 +68,7 @@ namespace audio::impl{
|
||||
void exit();
|
||||
size_t output_channels()const;
|
||||
private:
|
||||
static int callback(const void* /*input*/, void* output, unsigned long frame_count, mixer& mix);
|
||||
static int callback(const void* /*input*/, void* output, unsigned long frame_count, unsigned long flags, mixer& mix);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@ -100,7 +100,9 @@ namespace audio::impl{
|
||||
size_t mixer::output_channels()const{
|
||||
return m_output_sink.output_count();
|
||||
}
|
||||
int mixer::callback(const void* /*input*/, void* output, unsigned long frame_count, mixer& mix){
|
||||
int mixer::callback(const void* /*input*/, void* output, unsigned long frame_count, unsigned long flags, mixer& mix){
|
||||
if(flags & paPrimingOutput)
|
||||
return paContinue;
|
||||
//mark mixer data as being processed
|
||||
mix.set_active(true);
|
||||
|
||||
|
||||
@ -81,11 +81,11 @@ namespace audio{
|
||||
return Pa_OpenStream(stream, inp, outp, samplerate, paFramesPerBufferUnspecified, paNoFlag, callback, cb);
|
||||
}
|
||||
int stream::callback(const void* input, void* output, unsigned long framecount,
|
||||
const PaStreamCallbackTimeInfo* /*timeInfo*/, PaStreamCallbackFlags /*statusFlags*/,
|
||||
const PaStreamCallbackTimeInfo* timeinfo, PaStreamCallbackFlags statusflags,
|
||||
void* userdata)
|
||||
{
|
||||
detail::callback_iface* cb = static_cast<detail::callback_iface*>(userdata);
|
||||
return (*cb)(input, output, framecount);
|
||||
return (*cb)(input, output, framecount, statusflags);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -143,7 +143,6 @@ void gay_thread(audio::mixer& m, std::atomic_bool& should_gay_thread_stop){
|
||||
int main(){
|
||||
srand(time(NULL));
|
||||
audio::mixer mix(audio::mixer::mode::STEREO, 1);
|
||||
audio::mixchunk ch = read_audio_file(select_audio_file().c_str());
|
||||
game_state gs = {};
|
||||
|
||||
manager.init(640, 480, "Tic-Tac-Gugh");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user