29 ,
public Nano::Observer
39 if(path.endsWith(
"rx2"))
44 lay->addWidget(&m_playstop);
45 lay->addWidget(&m_name);
46 m_name.setText(QFileInfo{path}.fileName());
47 m_reader.on_finishedDecoding.connect<&AudioPreviewWidget::on_finishedDecoding>(
49 m_reader.load({path, path, DecodingMethod::Libav});
51 m_playPixmap = score::get_pixmap(
":/icons/play_off.png");
52 m_stopPixmap = score::get_pixmap(
":/icons/stop_off.png");
54 m_playstop.setIcon(m_playPixmap);
56 m_playstop.setMinimumWidth(24);
57 m_playstop.setMaximumWidth(24);
59 connect(&m_playstop, &QPushButton::clicked,
this, [&]() {
73 void on_finishedDecoding()
77 m_playstop.setChecked(
false);
82 bool autoPlay()
const noexcept {
return m_autoPlay; }
83 void setAutoPlay(
bool b)
94 int rate = audio.getRate();
96 auto& inst = Audio::AudioPreviewExecutor::instance();
97 auto reader = m_reader.unsafe_handle().target<AudioFile::libav_ptr>();
99 SCORE_ASSERT((*reader)->handle);
100 inst.queue.enqueue({(*reader)->handle, (int)m_reader.channels(), (int)rate});
102 m_playstop.setIcon(m_stopPixmap);
107 auto& inst = Audio::AudioPreviewExecutor::instance();
108 inst.queue.enqueue({});
110 m_playstop.setIcon(m_playPixmap);
114 QPushButton m_playstop{
this};
116 QPixmap m_playPixmap;
117 QPixmap m_stopPixmap;
119 static inline bool m_autoPlay{
false};
T & settings() const
Access a specific Settings model instance.
Definition ApplicationContext.hpp:40