Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export as ".wav" does not append extension #764

Closed
tresf opened this issue May 24, 2014 · 7 comments
Closed

Export as ".wav" does not append extension #764

tresf opened this issue May 24, 2014 · 7 comments

Comments

@tresf
Copy link
Member

tresf commented May 24, 2014

I noticed this on Ubuntu, but it may occur on other platforms. Exporting a track as a wav format seems to omit the file extension if one is not provided.

screen shot 2014-05-23 at 10 05 10 pm     screen shot 2014-05-23 at 10 05 17 pm     screen shot 2014-05-23 at 10 05 28 pm

When "Files of type" is set to "WAV", the file name should alway have ".wav" appended, but this doesn't seem to be the case if the name is typed without one.

This is likely caused by the additional settings dialog which asks a second time which format the file should be in, but doesn't actually do anything to determine that the provided extension is correct or that there is even an extension provided at all.

This does not happen on the Save Project dialog. If "mmpz" is omitted, the dialog corrects this behavior by placing the file extension on the end of it.

This is normally ok in Ubuntu because the Ubuntu desktop still recognizes the file as a WAV regardless of whether it has an extension or not, however LMMS is not so forgiving and will not import a WAV file without the proper extension.

@StakeoutPunch
Copy link

This happens if you don't specify the file type in the name regardless when you are exporting. This has been a "bug" since before 4.13, when I had issues with it.

@musikBear
Copy link

sugest splitting all composite save-selection ext.
Ex in basic project save there are two options

  1. mmp, mmmz
  2. mmt
    I sugest to explode to atomic options (here and in any and all save-dialog):
  3. mmp
    2)mmmz
  4. mmt

@tresf
Copy link
Member Author

tresf commented May 26, 2014

@musikBear,

How is this relevant to .WAV and .OGG export?

Edit: Furthermore, I don't agree mmp should be in the drop-down since it's for advanced users and in the rare event it is needed, the user can type ".mmp".

@tresf
Copy link
Member Author

tresf commented May 26, 2014

I think I got it. It's a bit ugly because Qt won't let you just grab the file extension, so I had to parse it from the drop-down description. I tested it with "Export tracks" and it seems be be ok because it never finds the file filter (i.e. (*.wav)) and just appends an empty string "".

This works whether or not a file extension has been clicked from the drop down and still works when the extension has been typed. It's not smart enough to change a .wav to a .ogg though (unless using the dropdown), instead you'd get untitled.wav.ogg, which should be pretty constant with the behavior in any save dialog.

An additional enhancement should be made to the export settings dialog to rename it's own title when it's own extension drop-down has been changed. This is relatively minor.

song.cpp#L1198

    if( efd.exec() == QDialog::Accepted &&
        !efd.selectedFiles().isEmpty() && !efd.selectedFiles()[0].isEmpty() )
    {

        int suffix_begin = efd.selectedNameFilter().indexOf("(*.");
        int suffix_end = efd.selectedNameFilter().indexOf(")");

        QString export_file_suffix = "";
        if (suffix_begin != -1 && suffix_end > suffix_begin) 
        {

            // Determined selected file extension, i.e. get ".wav" from "WAV-File (*.wav)
            export_file_suffix = efd.selectedNameFilter().mid(suffix_begin + 2, suffix_end - suffix_begin - 2);

            // If multiple extensions are listed, only get the first (i.e. ".wav .WAV")
            export_file_suffix = export_file_suffix.split(" ")[0].trimmed();

            // Don't add the suffix if it is already specified
            if ( efd.selectedFiles()[0].endsWith(export_file_suffix) ) 
            {
                export_file_suffix = "";
            }
        }

        const QString export_file_name = efd.selectedFiles()[0] + export_file_suffix;
        exportProjectDialog epd( export_file_name,
                        engine::mainWindow(), multiExport );
        epd.exec();
    }

@musikBear
Copy link

How is this relevant to .WAV and .OGG export?
I wrote all dialogs, eg including export, I just used an example i could remember
'type-in' is somewhat takky. Would prefere selectable dialog-options, but thats serious minor, and only imo

@tresf
Copy link
Member Author

tresf commented May 27, 2014

I wrote all dialogs, eg including export, I just used an example i could remember 'type-in' is somewhat takky. Would prefere selectable dialog-options, but thats serious minor, and only imo

Then please open your own bug report for that. What you are describing is an enhancement whereas this issues is a very specific bug and is unrelated to what you describe.

In fact, you could make your change now by forking and commit the change quickly via web browser if you wanted to avoid downloading the repo... Just browse the source code and find the right file with the *.mmp option.

The issue I'm describing seems to be caused by a combination of QFileDialog with our export settings dialog and unlike the other dialogs. This behavior is undesirable when an extension is not specified because it defaults to no extension at all. On the contrary, the dialog you are describing works as expected but not how you'd like it to behave. (This is because the save dialog does properly append .mmpz when an extension is not specified).

To say "all dialogs" is OK in casual conversation, but I'm going fix and close this bug report soon and your requests will get left behind as they are part of completely different code (and in my opinion already work just fine).

@tresf
Copy link
Member Author

tresf commented May 28, 2014

Closed per #779

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants