Skip to content

Should clean up what filetypes we claim to support on OSX #41

@AlisterH

Description

@AlisterH

I think I intended (and forgot) to do more work on this section of /contrib/macosx/osx_packaging/Gtk Wave Cleaner.app/Contents/Info.plist:

    <key>CFBundleDocumentTypes</key>
    <array>
        <dict>
            <key>CFBundleTypeName</key>
            <string>Audio File</string>
            <key>CFBundleTypeExtensions</key>
            <array>
                <string>wav</string>
                <string>aiff</string>
                <string>au</string>
                <string>snd</string>
                <string>flac</string>
                <string>ogg</string>
                <string>mp3</string>
            </array>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
        </dict>
    </array>

I believe this is wrong, because GWC can only export mp3 and ogg files - it can't open them. The other types can all be edited, but I think currently the only other one that can be exported is wav.

Also:

  • I'm not even sure that this is doing things right e.g. calling everything "Audio File" and using only extensions, not mimetypes.
  • AI suggests there are newer ways of doing things which should be used to support the latest OSX
  • This doesn't include many of the more obscure formats supported by libsndfile

Compare with this code from gwc.c - this was the file extensions associated with all the supported filetypes when I looked into it years ago:

	gtk_file_filter_set_name(ff,"Known extensions");
	// I think we could borrow code from mhwaveedit which gets the list of formats from libsndfile, 
	// but I don't think it would tell us all the extensions, and we'd need to make it only tell us
	// formats which support rdwr
	//
	// We could also borrow the dialog from mhwaveedit which allows you to open a raw audio file,
	// And it would also be good to be able to load raw audio specifying its format from the command line
	gtk_file_filter_add_pattern(ff,"*.wav");
	gtk_file_filter_add_pattern(ff,"*.wavpcm");
	gtk_file_filter_add_pattern(ff,"*.aiff");
	gtk_file_filter_add_pattern(ff,"*.aif");
	// when I try to create this format it actually seems the same as aiff, so not sure if we really do support it.
	gtk_file_filter_add_pattern(ff,"*.aiffc");
	gtk_file_filter_add_pattern(ff,"*.aifc");
	gtk_file_filter_add_pattern(ff,"*.au");
	gtk_file_filter_add_pattern(ff,"*.snd");
	gtk_file_filter_add_pattern(ff,"*.avr");
	gtk_file_filter_add_pattern(ff,"*.caf");
	gtk_file_filter_add_pattern(ff,"*.htk");
	gtk_file_filter_add_pattern(ff,"*.iff");
	gtk_file_filter_add_pattern(ff,"*.mat");
	gtk_file_filter_add_pattern(ff,"*.mat4");
	gtk_file_filter_add_pattern(ff,"*.mat5");
	gtk_file_filter_add_pattern(ff,"*.mpc");
	gtk_file_filter_add_pattern(ff,"*.paf");
	gtk_file_filter_add_pattern(ff,"*.pvf");
	gtk_file_filter_add_pattern(ff,"*.rf64");
	gtk_file_filter_add_pattern(ff,"*.sd2");
	gtk_file_filter_add_pattern(ff,"*.sds");
	gtk_file_filter_add_pattern(ff,"*.sf");
	gtk_file_filter_add_pattern(ff,"*.voc");
	gtk_file_filter_add_pattern(ff,"*.w64");
	gtk_file_filter_add_pattern(ff,"*.wve");
	gtk_file_filter_add_pattern(ff,"*.WAV");
	gtk_file_filter_add_pattern(ff,"*.WAVPCM");
	gtk_file_filter_add_pattern(ff,"*.AIFF");
	gtk_file_filter_add_pattern(ff,"*.AIF");
	gtk_file_filter_add_pattern(ff,"*.AIFFC");
	gtk_file_filter_add_pattern(ff,"*.AIFC");
	gtk_file_filter_add_pattern(ff,"*.AU");
	gtk_file_filter_add_pattern(ff,"*.SND");
	gtk_file_filter_add_pattern(ff,"*.AVR");
	gtk_file_filter_add_pattern(ff,"*.CAF");
	gtk_file_filter_add_pattern(ff,"*.HTK");
	gtk_file_filter_add_pattern(ff,"*.IFF");
	gtk_file_filter_add_pattern(ff,"*.MAT");
	gtk_file_filter_add_pattern(ff,"*.MAT4");
	gtk_file_filter_add_pattern(ff,"*.MAT5");
	gtk_file_filter_add_pattern(ff,"*.MPC");
	// note that this format seems to be broken when written by ffmpeg, but mhwaveedit is OK
	gtk_file_filter_add_pattern(ff,"*.PAF");
	gtk_file_filter_add_pattern(ff,"*.PVF");
	gtk_file_filter_add_pattern(ff,"*.RF64");
	gtk_file_filter_add_pattern(ff,"*.SD2");
	gtk_file_filter_add_pattern(ff,"*.SDS");
	gtk_file_filter_add_pattern(ff,"*.SF");
	// note that this format seems to be broken when written by ffmpeg, but mhwaveedit is OK
	gtk_file_filter_add_pattern(ff,"*.VOC");
	gtk_file_filter_add_pattern(ff,"*.W64");
	// note that this format seems to be broken when written by mhwaveedit, but sox is OK
	gtk_file_filter_add_pattern(ff,"*.WVE");
	// note libsndfile also supports reading and writing FLAC & ALAC, but does not support opening them in RDWR mode
	// and it supports reading and writing OGG, but I wasn't able to generate an OGG that it supported!
``

AI suggests that we should possibly be using code something like this (but I haven't got it to include most of the formats):
``

<key>CFBundleDocumentTypes</key>
<array>

  <!-- WAV: read & write (Editor) -->
  <dict>
    <key>CFBundleTypeName</key>
    <string>WAV audio</string>
    <key>CFBundleTypeRole</key>
    <string>Editor</string>

    <!-- Old-style associations -->
    <key>CFBundleTypeExtensions</key>
    <array>
      <string>wav</string>
      <string>wave</string>
    </array>
    <key>CFBundleTypeMIMETypes</key>
    <array>
      <string>audio/wav</string>
      <string>audio/x-wav</string>
    </array>

    <!-- Modern UTI association -->
    <key>LSItemContentTypes</key>
    <array>
      <string>com.microsoft.waveform-audio</string>
    </array>

    <!-- Export-only targets: WAV (same type), MP3, Ogg Vorbis.
         NOTE: FLAC intentionally *not* listed. -->
    <key>NSExportableTypes</key>
    <array>
      <string>com.microsoft.waveform-audio</string> <!-- export-to-WAV -->
      <string>public.mp3</string>                   <!-- export-to-MP3 -->
      <string>org.xiph.ogg-audio</string>           <!-- export-to-Ogg Vorbis -->
    </array>

    <!-- Optional per-type icon -->
    <!-- <key>CFBundleTypeIconFile</key><string>wav.icns</string> -->
  </dict>

  <!-- FLAC: read & write (Editor) -->
  <dict>
    <key>CFBundleTypeName</key>
    <string>FLAC audio</string>
    <key>CFBundleTypeRole</key>
    <string>Editor</string>

    <!-- Old-style associations -->
    <key>CFBundleTypeExtensions</key>
    <array>
      <string>flac</string>
    </array>
    <key>CFBundleTypeMIMETypes</key>
    <array>
      <string>audio/flac</string>
    </array>

    <!-- Modern UTI association -->
    <key>LSItemContentTypes</key>
    <array>
      <string>org.xiph.flac</string>
    </array>

    <!-- Export-only targets: WAV, MP3, Ogg Vorbis.
         NOTE: FLAC intentionally *not* listed. -->
    <key>NSExportableTypes</key>
    <array>
      <string>com.microsoft.waveform-audio</string> <!-- export FLAC -> WAV -->
      <string>public.mp3</string>                   <!-- export FLAC -> MP3 -->
      <string>org.xiph.ogg-audio</string>           <!-- export FLAC -> Ogg -->
    </array>

    <!-- Optional per-type icon -->
    <!-- <key>CFBundleTypeIconFile</key><string>flac.icns</string> -->
  </dict>

  <!-- No entries for MP3 or Ogg as Viewer/Editor:
       Your app does not open them; it only exports to them. -->

</array>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions