Compare commits
No commits in common. "e4b5f9af5ebfb202e9e28f020f4a10aa57af0565" and "8762983cc7031e0ed96dd8e43706a991ccaad2c6" have entirely different histories.
e4b5f9af5e
...
8762983cc7
5 changed files with 2 additions and 77 deletions
|
|
@ -69,7 +69,7 @@ void AudioPlayer::play(std::shared_ptr<QByteArray> audioData)
|
||||||
buffer->setParent(this);
|
buffer->setParent(this);
|
||||||
|
|
||||||
// Use QMediaPlayer::setSourceDevice for in-memory playback
|
// Use QMediaPlayer::setSourceDevice for in-memory playback
|
||||||
mediaPlayer->setSourceDevice(buffer);
|
mediaPlayer->setSourceDevice(buffer, QUrl("memory://audio.wav"));
|
||||||
mediaPlayer->play();
|
mediaPlayer->play();
|
||||||
|
|
||||||
// Start position timer
|
// Start position timer
|
||||||
|
|
@ -120,19 +120,6 @@ int AudioPlayer::position() const
|
||||||
return mediaPlayer->position();
|
return mediaPlayer->position();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioPlayer::setVolume(int volume)
|
|
||||||
{
|
|
||||||
// Convert from 0-100 range to 0.0-1.0 range
|
|
||||||
qreal volumeLevel = static_cast<qreal>(volume) / 100.0;
|
|
||||||
audioOutput->setVolume(volumeLevel);
|
|
||||||
}
|
|
||||||
|
|
||||||
int AudioPlayer::getVolume() const
|
|
||||||
{
|
|
||||||
// Convert from 0.0-1.0 range to 0-100 range
|
|
||||||
return static_cast<int>(audioOutput->volume() * 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AudioPlayer::handlePlaybackStateChanged(QMediaPlayer::PlaybackState state)
|
void AudioPlayer::handlePlaybackStateChanged(QMediaPlayer::PlaybackState state)
|
||||||
{
|
{
|
||||||
if (state == QMediaPlayer::PlayingState)
|
if (state == QMediaPlayer::PlayingState)
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,6 @@ public:
|
||||||
bool isPlaying() const;
|
bool isPlaying() const;
|
||||||
int duration() const;
|
int duration() const;
|
||||||
int position() const;
|
int position() const;
|
||||||
void setVolume(int volume);
|
|
||||||
int getVolume() const;
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void playbackStarted();
|
void playbackStarted();
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,6 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
connect(ui->skipButton, &QPushButton::clicked, this, &MainWindow::onSkipButtonClicked);
|
connect(ui->skipButton, &QPushButton::clicked, this, &MainWindow::onSkipButtonClicked);
|
||||||
connect(ui->stopButton, &QPushButton::clicked, this, &MainWindow::onStopButtonClicked);
|
connect(ui->stopButton, &QPushButton::clicked, this, &MainWindow::onStopButtonClicked);
|
||||||
connect(ui->shuffleButton, &QPushButton::clicked, this, &MainWindow::onShuffleButtonClicked);
|
connect(ui->shuffleButton, &QPushButton::clicked, this, &MainWindow::onShuffleButtonClicked);
|
||||||
connect(ui->volumeSlider, &QSlider::valueChanged, this, &MainWindow::onVolumeSliderValueChanged);
|
|
||||||
connect(ui->addSongButton, &QPushButton::clicked, this, &MainWindow::onAddSongButtonClicked);
|
connect(ui->addSongButton, &QPushButton::clicked, this, &MainWindow::onAddSongButtonClicked);
|
||||||
connect(ui->removeSongButton, &QPushButton::clicked, this, &MainWindow::onRemoveSongButtonClicked);
|
connect(ui->removeSongButton, &QPushButton::clicked, this, &MainWindow::onRemoveSongButtonClicked);
|
||||||
connect(ui->actionAdvancedSettings, &QAction::triggered, this, &MainWindow::onAdvancedSettingsButtonClicked);
|
connect(ui->actionAdvancedSettings, &QAction::triggered, this, &MainWindow::onAdvancedSettingsButtonClicked);
|
||||||
|
|
@ -62,7 +61,6 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
connect(ui->actionLoadPlaylist, &QAction::triggered, this, &MainWindow::onActionLoadPlaylist);
|
connect(ui->actionLoadPlaylist, &QAction::triggered, this, &MainWindow::onActionLoadPlaylist);
|
||||||
connect(ui->actionAppendPlaylist, &QAction::triggered, this, &MainWindow::onActionAppendPlaylist);
|
connect(ui->actionAppendPlaylist, &QAction::triggered, this, &MainWindow::onActionAppendPlaylist);
|
||||||
connect(ui->actionSaveSong, &QAction::triggered, this, &MainWindow::onActionSaveSong);
|
connect(ui->actionSaveSong, &QAction::triggered, this, &MainWindow::onActionSaveSong);
|
||||||
connect(ui->positionSlider, &QSlider::sliderMoved, this, &MainWindow::onPositionSliderSliderMoved);
|
|
||||||
connect(ui->actionQuit, &QAction::triggered, this, [this]()
|
connect(ui->actionQuit, &QAction::triggered, this, [this]()
|
||||||
{
|
{
|
||||||
close();
|
close();
|
||||||
|
|
@ -112,9 +110,6 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
|
|
||||||
currentSong = songModel->getSong(0);
|
currentSong = songModel->getSong(0);
|
||||||
|
|
||||||
// Set default volume (50% from UI)
|
|
||||||
audioPlayer->setVolume(ui->volumeSlider->value());
|
|
||||||
|
|
||||||
// Start the worker thread and enter its event loop
|
// Start the worker thread and enter its event loop
|
||||||
QObject::connect(&aceThread, &QThread::started, [this]() {qDebug() << "Worker thread started";});
|
QObject::connect(&aceThread, &QThread::started, [this]() {qDebug() << "Worker thread started";});
|
||||||
aceThread.start();
|
aceThread.start();
|
||||||
|
|
@ -165,10 +160,6 @@ void MainWindow::loadSettings()
|
||||||
shuffleMode = settings.value("shuffleMode", false).toBool();
|
shuffleMode = settings.value("shuffleMode", false).toBool();
|
||||||
ui->shuffleButton->setChecked(shuffleMode);
|
ui->shuffleButton->setChecked(shuffleMode);
|
||||||
|
|
||||||
// Load volume setting
|
|
||||||
int savedVolume = settings.value("volume", 50).toInt();
|
|
||||||
ui->volumeSlider->setValue(savedVolume);
|
|
||||||
|
|
||||||
// Load path settings with defaults based on application directory
|
// Load path settings with defaults based on application directory
|
||||||
QString appDir = QCoreApplication::applicationDirPath();
|
QString appDir = QCoreApplication::applicationDirPath();
|
||||||
qwen3ModelPath = settings.value("qwen3ModelPath",
|
qwen3ModelPath = settings.value("qwen3ModelPath",
|
||||||
|
|
@ -197,9 +188,6 @@ void MainWindow::saveSettings()
|
||||||
// Save shuffle mode
|
// Save shuffle mode
|
||||||
settings.setValue("shuffleMode", shuffleMode);
|
settings.setValue("shuffleMode", shuffleMode);
|
||||||
|
|
||||||
// Save volume setting
|
|
||||||
settings.setValue("volume", ui->volumeSlider->value());
|
|
||||||
|
|
||||||
// Save path settings
|
// Save path settings
|
||||||
settings.setValue("qwen3ModelPath", qwen3ModelPath);
|
settings.setValue("qwen3ModelPath", qwen3ModelPath);
|
||||||
settings.setValue("textEncoderModelPath", textEncoderModelPath);
|
settings.setValue("textEncoderModelPath", textEncoderModelPath);
|
||||||
|
|
@ -559,11 +547,6 @@ void MainWindow::onPositionSliderSliderMoved(int position)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onVolumeSliderValueChanged(int value)
|
|
||||||
{
|
|
||||||
audioPlayer->setVolume(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::ensureSongsInQueue(bool enqeueCurrent)
|
void MainWindow::ensureSongsInQueue(bool enqeueCurrent)
|
||||||
{
|
{
|
||||||
// Only generate more songs if we're playing and not already at capacity
|
// Only generate more songs if we're playing and not already at capacity
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,6 @@ private slots:
|
||||||
void onStopButtonClicked();
|
void onStopButtonClicked();
|
||||||
void onShuffleButtonClicked();
|
void onShuffleButtonClicked();
|
||||||
void onPositionSliderSliderMoved(int position);
|
void onPositionSliderSliderMoved(int position);
|
||||||
void onVolumeSliderValueChanged(int value);
|
|
||||||
void updatePosition(int position);
|
void updatePosition(int position);
|
||||||
void updateDuration(int duration);
|
void updateDuration(int duration);
|
||||||
void onAddSongButtonClicked();
|
void onAddSongButtonClicked();
|
||||||
|
|
|
||||||
|
|
@ -222,56 +222,14 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer_3">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Orientation::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>15</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="volumeLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Volume:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QSlider" name="volumeSlider">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>100</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>100</number>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>50</number>
|
|
||||||
</property>
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Orientation::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_2">
|
<spacer name="horizontalSpacer_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Orientation::Horizontal</enum>
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::Policy::Fixed</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>35</width>
|
<width>40</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue