FDD audio selection to None + disabled if drive not selected. Load audio profiles on audio settings change to take immediate action when VM already running.

This commit is contained in:
Toni Riikonen
2025-11-26 23:08:47 +02:00
parent a786ab8436
commit 09efaeeb29
3 changed files with 22 additions and 2 deletions

View File

@@ -313,6 +313,20 @@ SettingsFloppyCDROM::onFloppyRowChanged(const QModelIndex &current)
int row = current.row();
ui->comboBoxFloppyAudio->clear();
if (type == 0) {
ui->comboBoxFloppyAudio->addItem(tr("None"), 0);
ui->comboBoxFloppyAudio->setCurrentIndex(0);
ui->comboBoxFloppyAudio->setEnabled(false);
// Update the model to reflect "None" profile
auto audioIdx = current.siblingAtColumn(3);
ui->tableViewFloppy->model()->setData(audioIdx, tr("None"));
ui->tableViewFloppy->model()->setData(audioIdx, 0, Qt::UserRole);
return;
}
ui->comboBoxFloppyAudio->setEnabled(true);
// Get drive type's track count to determine 40-track vs 80-track
int drive_max_tracks = fdd_get_type_max_track(type);
bool is_40_track = (drive_max_tracks <= 43);
@@ -327,7 +341,9 @@ SettingsFloppyCDROM::onFloppyRowChanged(const QModelIndex &current)
const fdd_audio_profile_config_t *profile = fdd_audio_get_profile(i);
if (profile) {
// Only show profiles that match the drive type's track count
if ((is_40_track && profile->total_tracks == 40) || (!is_40_track && profile->total_tracks == 80) || profile->total_tracks == 0) { // Profile ID 0 is "None"
if (profile->total_tracks == 0 ||
(is_40_track && profile->total_tracks == 40) ||
(!is_40_track && profile->total_tracks == 80)) {
ui->comboBoxFloppyAudio->addItem(name, i);
if (i == prof) {
currentProfileIndex = comboIndex;
@@ -449,6 +465,9 @@ SettingsFloppyCDROM::on_comboBoxFloppyAudio_activated(int)
} else {
profName = tr("None");
}
if (prof > 0) {
load_profile_samples(prof);
}
#else
profName = tr("None");
#endif