Browse Source

audio/midi file plugins should alway list their file "presets"

tags/v2.3.0-RC1
falkTX 3 years ago
parent
commit
8959107b0f
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
2 changed files with 21 additions and 58 deletions
  1. +19
    -36
      source/native-plugins/audio-file.cpp
  2. +2
    -22
      source/native-plugins/midi-file.cpp

+ 19
- 36
source/native-plugins/audio-file.cpp View File

@@ -20,56 +20,43 @@


#include "audio-base.hpp" #include "audio-base.hpp"


#ifdef HAVE_PYQT
static const char* const audiofilesWildcard = static const char* const audiofilesWildcard =
# ifdef HAVE_SNDFILE
#ifdef HAVE_SNDFILE
"*.aif;*.aifc;*.aiff;*.au;*.bwf;*.flac;*.htk;*.iff;*.mat4;*.mat5;*.oga;*.ogg;" "*.aif;*.aifc;*.aiff;*.au;*.bwf;*.flac;*.htk;*.iff;*.mat4;*.mat5;*.oga;*.ogg;"
"*.paf;*.pvf;*.pvf5;*.sd2;*.sf;*.snd;*.svx;*.vcc;*.w64;*.wav;*.xi;" "*.paf;*.pvf;*.pvf5;*.sd2;*.sf;*.snd;*.svx;*.vcc;*.w64;*.wav;*.xi;"
# endif
# ifdef HAVE_FFMPEG
#endif
#ifdef HAVE_FFMPEG
"*.3g2;*.3gp;*.aac;*.ac3;*.amr;*.ape;*.mp2;*.mp3;*.mpc;*.wma;" "*.3g2;*.3gp;*.aac;*.ac3;*.amr;*.ape;*.mp2;*.mp3;*.mpc;*.wma;"
# ifndef HAVE_SNDFILE
# ifndef HAVE_SNDFILE
"*.flac;*.oga;*.ogg;*.w64;*.wav;" "*.flac;*.oga;*.ogg;*.w64;*.wav;"
# endif
# endif # endif
# if !defined(HAVE_SNDFILE) && !defined(HAVE_FFMPEG)
#endif
#if !defined(HAVE_SNDFILE) && !defined(HAVE_FFMPEG)
"" ""
# ifndef BUILDING_FOR_CI
# warning sndfile and ffmpeg libraries missing, no audio file support will be available
# endif
# ifndef BUILDING_FOR_CI
# warning sndfile and ffmpeg libraries missing, no audio file support will be available
# endif # endif
;
#else
# define process2 process
#endif #endif
;


// ----------------------------------------------------------------------- // -----------------------------------------------------------------------


#ifdef HAVE_PYQT
class AudioFilePlugin : public NativePluginWithMidiPrograms<FileAudio>, class AudioFilePlugin : public NativePluginWithMidiPrograms<FileAudio>,
public AbstractAudioPlayer public AbstractAudioPlayer
#else
class AudioFilePlugin : public NativePluginClass,
public AbstractAudioPlayer
#endif
{ {
public: public:
AudioFilePlugin(const NativeHostDescriptor* const host) AudioFilePlugin(const NativeHostDescriptor* const host)
#ifdef HAVE_PYQT
: NativePluginWithMidiPrograms<FileAudio>(host, fPrograms, 2), : NativePluginWithMidiPrograms<FileAudio>(host, fPrograms, 2),
#else
: NativePluginClass(host),
#endif
AbstractAudioPlayer(), AbstractAudioPlayer(),
fLoopMode(true), fLoopMode(true),
fDoProcess(false), fDoProcess(false),
fLastFrame(0), fLastFrame(0),
fMaxFrame(0), fMaxFrame(0),
fPool(), fPool(),
fThread(this)
#ifdef HAVE_PYQT
, fPrograms(hostGetFilePath("audio"), audiofilesWildcard),
fInlineDisplay()
fThread(this),
fPrograms(hostGetFilePath("audio"), audiofilesWildcard)
#ifndef __MOD_DEVICES__
, fInlineDisplay()
#endif #endif
{ {
} }
@@ -147,9 +134,7 @@ protected:
if (std::strcmp(key, "file") != 0) if (std::strcmp(key, "file") != 0)
return; return;


#ifdef HAVE_PYQT
invalidateNextFilename(); invalidateNextFilename();
#endif
loadFilename(value); loadFilename(value);
} }


@@ -196,7 +181,7 @@ protected:
carla_zeroFloats(out1, frames); carla_zeroFloats(out1, frames);
carla_zeroFloats(out2, frames); carla_zeroFloats(out2, frames);


#ifdef HAVE_PYQT
#ifndef __MOD_DEVICES__
if (fInlineDisplay.writtenValues < 32) if (fInlineDisplay.writtenValues < 32)
{ {
fInlineDisplay.lastValuesL[fInlineDisplay.writtenValues] = 0.0f; fInlineDisplay.lastValuesL[fInlineDisplay.writtenValues] = 0.0f;
@@ -266,7 +251,7 @@ protected:
} }
} }


#ifdef HAVE_PYQT
#ifndef __MOD_DEVICES__
if (fInlineDisplay.writtenValues < 32) if (fInlineDisplay.writtenValues < 32)
{ {
fInlineDisplay.lastValuesL[fInlineDisplay.writtenValues] = carla_findMaxNormalizedFloat(out1, frames); fInlineDisplay.lastValuesL[fInlineDisplay.writtenValues] = carla_findMaxNormalizedFloat(out1, frames);
@@ -301,17 +286,15 @@ protected:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Plugin state calls // Plugin state calls


#ifdef HAVE_PYQT
void setStateFromFile(const char* const filename) override void setStateFromFile(const char* const filename) override
{ {
loadFilename(filename); loadFilename(filename);
} }
#endif


// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Plugin dispatcher calls // Plugin dispatcher calls


#ifdef HAVE_PYQT
#ifndef __MOD_DEVICES__
const NativeInlineDisplayImageSurface* renderInlineDisplay(const uint32_t rwidth, const uint32_t height) override const NativeInlineDisplayImageSurface* renderInlineDisplay(const uint32_t rwidth, const uint32_t height) override
{ {
CARLA_SAFE_ASSERT_RETURN(height > 4, nullptr); CARLA_SAFE_ASSERT_RETURN(height > 4, nullptr);
@@ -435,9 +418,9 @@ private:
AudioFilePool fPool; AudioFilePool fPool;
AudioFileThread fThread; AudioFileThread fThread;


#ifdef HAVE_PYQT
NativeMidiPrograms fPrograms; NativeMidiPrograms fPrograms;


#ifndef __MOD_DEVICES__
struct InlineDisplay : NativeInlineDisplayImageSurfaceCompat { struct InlineDisplay : NativeInlineDisplayImageSurfaceCompat {
float lastValuesL[32]; float lastValuesL[32];
float lastValuesR[32]; float lastValuesR[32];
@@ -517,10 +500,10 @@ static const NativePluginDescriptor audiofileDesc = {
/* category */ NATIVE_PLUGIN_CATEGORY_UTILITY, /* category */ NATIVE_PLUGIN_CATEGORY_UTILITY,
/* hints */ static_cast<NativePluginHints>(NATIVE_PLUGIN_IS_RTSAFE /* hints */ static_cast<NativePluginHints>(NATIVE_PLUGIN_IS_RTSAFE
|NATIVE_PLUGIN_HAS_UI |NATIVE_PLUGIN_HAS_UI
#ifdef HAVE_PYQT
#ifndef __MOD_DEVICES__
|NATIVE_PLUGIN_HAS_INLINE_DISPLAY |NATIVE_PLUGIN_HAS_INLINE_DISPLAY
|NATIVE_PLUGIN_REQUESTS_IDLE
#endif #endif
|NATIVE_PLUGIN_REQUESTS_IDLE
|NATIVE_PLUGIN_NEEDS_UI_OPEN_SAVE |NATIVE_PLUGIN_NEEDS_UI_OPEN_SAVE
|NATIVE_PLUGIN_USES_TIME), |NATIVE_PLUGIN_USES_TIME),
/* supports */ NATIVE_PLUGIN_SUPPORTS_NOTHING, /* supports */ NATIVE_PLUGIN_SUPPORTS_NOTHING,


+ 2
- 22
source/native-plugins/midi-file.cpp View File

@@ -21,32 +21,18 @@
#include "water/files/FileInputStream.h" #include "water/files/FileInputStream.h"
#include "water/midi/MidiFile.h" #include "water/midi/MidiFile.h"


#ifndef HAVE_PYQT
# define process2 process
#endif

// ----------------------------------------------------------------------- // -----------------------------------------------------------------------


#ifdef HAVE_PYQT
class MidiFilePlugin : public NativePluginWithMidiPrograms<FileMIDI>, class MidiFilePlugin : public NativePluginWithMidiPrograms<FileMIDI>,
#else
class MidiFilePlugin : public NativePluginClass,
#endif
public AbstractMidiPlayer public AbstractMidiPlayer
{ {
public: public:
MidiFilePlugin(const NativeHostDescriptor* const host) MidiFilePlugin(const NativeHostDescriptor* const host)
#ifdef HAVE_PYQT
: NativePluginWithMidiPrograms<FileMIDI>(host, fPrograms, 0), : NativePluginWithMidiPrograms<FileMIDI>(host, fPrograms, 0),
#else
: NativePluginClass(host),
#endif
fMidiOut(this), fMidiOut(this),
fNeedsAllNotesOff(false), fNeedsAllNotesOff(false),
fWasPlayingBefore(false)
#ifdef HAVE_PYQT
, fPrograms(hostGetFilePath("midi"), "*.mid;*.midi")
#endif
fWasPlayingBefore(false),
fPrograms(hostGetFilePath("midi"), "*.mid;*.midi")
{ {
} }


@@ -62,9 +48,7 @@ protected:
if (std::strcmp(key, "file") != 0) if (std::strcmp(key, "file") != 0)
return; return;


#ifdef HAVE_PYQT
invalidateNextFilename(); invalidateNextFilename();
#endif
_loadMidiFile(value); _loadMidiFile(value);
} }


@@ -137,12 +121,10 @@ protected:
fMidiOut.setState(data); fMidiOut.setState(data);
} }


#ifdef HAVE_PYQT
void setStateFromFile(const char* const filename) override void setStateFromFile(const char* const filename) override
{ {
_loadMidiFile(filename); _loadMidiFile(filename);
} }
#endif


// ------------------------------------------------------------------- // -------------------------------------------------------------------
// AbstractMidiPlayer calls // AbstractMidiPlayer calls
@@ -168,9 +150,7 @@ private:
MidiPattern fMidiOut; MidiPattern fMidiOut;
bool fNeedsAllNotesOff; bool fNeedsAllNotesOff;
bool fWasPlayingBefore; bool fWasPlayingBefore;
#ifdef HAVE_PYQT
NativeMidiPrograms fPrograms; NativeMidiPrograms fPrograms;
#endif


void _loadMidiFile(const char* const filename) void _loadMidiFile(const char* const filename)
{ {


Loading…
Cancel
Save