| @@ -892,7 +892,7 @@ public: | |||
| for (List<ConnectionToId>::Itenerator it = fUsedConnections.begin(); it.valid(); it.next()) | |||
| { | |||
| const ConnectionToId& connectionToId(*it); | |||
| const ConnectionToId& connectionToId(it.getConstValue()); | |||
| if (connectionToId.id == connectionId) | |||
| { | |||
| @@ -1349,7 +1349,7 @@ protected: | |||
| { | |||
| for (List<ConnectionToId>::Itenerator it = fUsedConnections.begin(); it.valid(); it.next()) | |||
| { | |||
| const ConnectionToId& connectionToId(*it); | |||
| const ConnectionToId& connectionToId(it.getConstValue()); | |||
| if (connectionToId.portOut == portIdA && connectionToId.portIn == portIdB) | |||
| { | |||
| @@ -1365,7 +1365,7 @@ protected: | |||
| { | |||
| for (List<GroupNameToId>::Itenerator it = fUsedGroupNames.begin(); it.valid(); it.next()) | |||
| { | |||
| GroupNameToId& groupNameToId(*it); | |||
| GroupNameToId& groupNameToId(it.getValue()); | |||
| if (std::strcmp(groupNameToId.name, oldName) == 0) | |||
| { | |||
| @@ -1401,7 +1401,7 @@ protected: | |||
| for (List<PortNameToId>::Itenerator it = fUsedPortNames.begin(); it.valid(); it.next()) | |||
| { | |||
| PortNameToId& portNameId(*it); | |||
| PortNameToId& portNameId(it.getValue()); | |||
| if (std::strcmp(portNameId.fullName, oldName) == 0) | |||
| { | |||
| @@ -1578,7 +1578,7 @@ private: | |||
| for (List<GroupNameToId>::Itenerator it = fUsedGroupNames.begin(); it.valid(); it.next()) | |||
| { | |||
| const GroupNameToId& groupNameId(*it); | |||
| const GroupNameToId& groupNameId(it.getConstValue()); | |||
| if (std::strcmp(groupNameId.name, name) == 0) | |||
| return groupNameId.id; | |||
| @@ -1595,7 +1595,7 @@ private: | |||
| for (List<GroupNameToId>::Itenerator it = fUsedGroupNames.begin(); it.valid(); it.next()) | |||
| { | |||
| const GroupNameToId& groupNameId(*it); | |||
| const GroupNameToId& groupNameId(it.getConstValue()); | |||
| if (groupNameId.id == groupId) | |||
| return groupNameId.name; | |||
| @@ -1610,7 +1610,7 @@ private: | |||
| for (List<PortNameToId>::Itenerator it = fUsedPortNames.begin(); it.valid(); it.next()) | |||
| { | |||
| const PortNameToId& portNameId(*it); | |||
| const PortNameToId& portNameId(it.getConstValue()); | |||
| if (std::strcmp(portNameId.fullName, fullName) == 0) | |||
| return portNameId.portId; | |||
| @@ -1623,7 +1623,7 @@ private: | |||
| { | |||
| for (List<PortNameToId>::Itenerator it = fUsedPortNames.begin(); it.valid(); it.next()) | |||
| { | |||
| const PortNameToId& portNameId(*it); | |||
| const PortNameToId& portNameId(it.getConstValue()); | |||
| if (portNameId.portId == portId) | |||
| { | |||
| @@ -331,7 +331,7 @@ public: | |||
| for (List<MidiPort>::Itenerator it = fMidiIns.begin(); it.valid(); it.next()) | |||
| { | |||
| MidiPort& port(*it); | |||
| MidiPort& port(it.getValue()); | |||
| RtMidiIn* const midiInPort((RtMidiIn*)port.rtmidi); | |||
| midiInPort->cancelCallback(); | |||
| @@ -340,7 +340,7 @@ public: | |||
| for (List<MidiPort>::Itenerator it = fMidiOuts.begin(); it.valid(); it.next()) | |||
| { | |||
| MidiPort& port(*it); | |||
| MidiPort& port(it.getValue()); | |||
| RtMidiOut* const midiOutPort((RtMidiOut*)port.rtmidi); | |||
| delete midiOutPort; | |||
| @@ -538,7 +538,7 @@ public: | |||
| for (List<ConnectionToId>::Itenerator it=fUsedConnections.begin(); it.valid(); it.next()) | |||
| { | |||
| const ConnectionToId& connection(*it); | |||
| const ConnectionToId& connection(it.getConstValue()); | |||
| if (connection.id == connectionId) | |||
| { | |||
| @@ -551,7 +551,7 @@ public: | |||
| for (List<MidiPort>::Itenerator it=fMidiOuts.begin(); it.valid(); it.next()) | |||
| { | |||
| MidiPort& midiPort(*it); | |||
| MidiPort& midiPort(it.getValue()); | |||
| if (midiPort.portId == portId) | |||
| { | |||
| @@ -570,7 +570,7 @@ public: | |||
| for (List<MidiPort>::Itenerator it=fMidiIns.begin(); it.valid(); it.next()) | |||
| { | |||
| MidiPort& midiPort(*it); | |||
| MidiPort& midiPort(it.getValue()); | |||
| if (midiPort.portId == portId) | |||
| { | |||
| @@ -721,7 +721,7 @@ public: | |||
| for (List<uint>::Itenerator it = fConnectedAudioIns[0].begin(); it.valid(); it.next()) | |||
| { | |||
| const uint& port(*it); | |||
| const uint& port(it.getConstValue()); | |||
| CARLA_ASSERT(port < fAudioCountIn); | |||
| ConnectionToId connectionToId; | |||
| @@ -737,7 +737,7 @@ public: | |||
| for (List<uint>::Itenerator it = fConnectedAudioIns[1].begin(); it.valid(); it.next()) | |||
| { | |||
| const uint& port(*it); | |||
| const uint& port(it.getConstValue()); | |||
| CARLA_ASSERT(port < fAudioCountIn); | |||
| ConnectionToId connectionToId; | |||
| @@ -753,7 +753,7 @@ public: | |||
| for (List<uint>::Itenerator it = fConnectedAudioOuts[0].begin(); it.valid(); it.next()) | |||
| { | |||
| const uint& port(*it); | |||
| const uint& port(it.getConstValue()); | |||
| CARLA_ASSERT(port < fAudioCountOut); | |||
| ConnectionToId connectionToId; | |||
| @@ -769,7 +769,7 @@ public: | |||
| for (List<uint>::Itenerator it = fConnectedAudioOuts[1].begin(); it.valid(); it.next()) | |||
| { | |||
| const uint& port(*it); | |||
| const uint& port(it.getConstValue()); | |||
| CARLA_ASSERT(port < fAudioCountOut); | |||
| ConnectionToId connectionToId; | |||
| @@ -787,7 +787,7 @@ public: | |||
| for (List<MidiPort>::Itenerator it=fMidiIns.begin(); it.valid(); it.next()) | |||
| { | |||
| const MidiPort& midiPort(*it); | |||
| const MidiPort& midiPort(it.getConstValue()); | |||
| ConnectionToId connectionToId; | |||
| connectionToId.id = fLastConnectionId; | |||
| @@ -802,7 +802,7 @@ public: | |||
| for (List<MidiPort>::Itenerator it=fMidiOuts.begin(); it.valid(); it.next()) | |||
| { | |||
| const MidiPort& midiPort(*it); | |||
| const MidiPort& midiPort(it.getConstValue()); | |||
| ConnectionToId connectionToId; | |||
| connectionToId.id = fLastConnectionId; | |||
| @@ -911,7 +911,7 @@ protected: | |||
| for (List<uint>::Itenerator it = fConnectedAudioIns[0].begin(); it.valid(); it.next()) | |||
| { | |||
| const uint& port(*it); | |||
| const uint& port(it.getConstValue()); | |||
| CARLA_ASSERT(port < fAudioCountIn); | |||
| if (first) | |||
| @@ -939,7 +939,7 @@ protected: | |||
| for (List<uint>::Itenerator it = fConnectedAudioIns[1].begin(); it.valid(); it.next()) | |||
| { | |||
| const uint& port(*it); | |||
| const uint& port(it.getConstValue()); | |||
| CARLA_ASSERT(port < fAudioCountIn); | |||
| if (first) | |||
| @@ -965,7 +965,7 @@ protected: | |||
| { | |||
| for (List<uint>::Itenerator it = fConnectedAudioOuts[0].begin(); it.valid(); it.next()) | |||
| { | |||
| const uint& port(*it); | |||
| const uint& port(it.getConstValue()); | |||
| CARLA_ASSERT(port < fAudioCountOut); | |||
| FLOAT_ADD(fAudioBufOut[port], fAudioBufRackOut[0], nframes); | |||
| @@ -976,7 +976,7 @@ protected: | |||
| { | |||
| for (List<uint>::Itenerator it = fConnectedAudioOuts[1].begin(); it.valid(); it.next()) | |||
| { | |||
| const uint& port(*it); | |||
| const uint& port(it.getConstValue()); | |||
| CARLA_ASSERT(port < fAudioCountOut); | |||
| FLOAT_ADD(fAudioBufOut[port], fAudioBufRackOut[1], nframes); | |||
| @@ -584,7 +584,7 @@ const SaveState& CarlaPlugin::getSaveState() | |||
| for (List<CustomData>::Itenerator it = pData->custom.begin(); it.valid(); it.next()) | |||
| { | |||
| const CustomData& cData(*it); | |||
| const CustomData& cData(it.getConstValue()); | |||
| StateCustomData* stateCustomData(new StateCustomData()); | |||
| @@ -611,7 +611,7 @@ void CarlaPlugin::loadSaveState(const SaveState& saveState) | |||
| for (List<StateCustomData*>::Itenerator it = saveState.customData.begin(); it.valid(); it.next()) | |||
| { | |||
| const StateCustomData* const stateCustomData(*it); | |||
| const StateCustomData* const stateCustomData(it.getConstValue()); | |||
| const char* const key(stateCustomData->key); | |||
| bool wantData = false; | |||
| @@ -691,7 +691,7 @@ void CarlaPlugin::loadSaveState(const SaveState& saveState) | |||
| for (List<StateParameter*>::Itenerator it = saveState.parameters.begin(); it.valid(); it.next()) | |||
| { | |||
| StateParameter* const stateParameter(*it); | |||
| StateParameter* const stateParameter(it.getValue()); | |||
| int32_t index = -1; | |||
| @@ -702,7 +702,7 @@ void CarlaPlugin::loadSaveState(const SaveState& saveState) | |||
| { | |||
| for (List<ParamSymbol*>::Itenerator it = paramSymbols.begin(); it.valid(); it.next()) | |||
| { | |||
| ParamSymbol* const paramSymbol(*it); | |||
| ParamSymbol* const paramSymbol(it.getValue()); | |||
| if (std::strcmp(stateParameter->symbol, paramSymbol->symbol) == 0) | |||
| { | |||
| @@ -723,7 +723,7 @@ void CarlaPlugin::loadSaveState(const SaveState& saveState) | |||
| { | |||
| for (List<ParamSymbol*>::Itenerator it = paramSymbols.begin(); it.valid(); it.next()) | |||
| { | |||
| ParamSymbol* const paramSymbol(*it); | |||
| ParamSymbol* const paramSymbol(it.getValue()); | |||
| if (std::strcmp(stateParameter->symbol, paramSymbol->symbol) == 0) | |||
| { | |||
| @@ -764,7 +764,7 @@ void CarlaPlugin::loadSaveState(const SaveState& saveState) | |||
| for (List<ParamSymbol*>::Itenerator it = paramSymbols.begin(); it.valid(); it.next()) | |||
| { | |||
| ParamSymbol* const paramSymbol(*it); | |||
| ParamSymbol* const paramSymbol(it.getValue()); | |||
| delete paramSymbol; | |||
| } | |||
| @@ -775,7 +775,7 @@ void CarlaPlugin::loadSaveState(const SaveState& saveState) | |||
| for (List<StateCustomData*>::Itenerator it = saveState.customData.begin(); it.valid(); it.next()) | |||
| { | |||
| const StateCustomData* const stateCustomData(*it); | |||
| const StateCustomData* const stateCustomData(it.getConstValue()); | |||
| const char* const key(stateCustomData->key); | |||
| if (getType() == PLUGIN_DSSI && (std::strcmp(key, "reloadprograms") == 0 || std::strcmp(key, "load") == 0 || std::strncmp(key, "patches", 7) == 0)) | |||
| @@ -1238,7 +1238,7 @@ void CarlaPlugin::setCustomData(const char* const type, const char* const key, c | |||
| // Check if we already have this key | |||
| for (List<CustomData>::Itenerator it = pData->custom.begin(); it.valid(); it.next()) | |||
| { | |||
| CustomData& cData(*it); | |||
| CustomData& cData(it.getValue()); | |||
| CARLA_ASSERT(cData.type != nullptr); | |||
| CARLA_ASSERT(cData.key != nullptr); | |||
| @@ -1694,7 +1694,7 @@ void CarlaPlugin::updateOscData(const lo_address& source, const char* const url) | |||
| for (List<CustomData>::Itenerator it = pData->custom.begin(); it.valid(); it.next()) | |||
| { | |||
| const CustomData& cData(*it); | |||
| const CustomData& cData(it.getConstValue()); | |||
| CARLA_ASSERT(cData.type != nullptr); | |||
| CARLA_ASSERT(cData.key != nullptr); | |||
| @@ -714,7 +714,7 @@ struct CarlaPluginProtectedData { | |||
| for (List<CustomData>::Itenerator it = custom.begin(); it.valid(); it.next()) | |||
| { | |||
| CustomData& cData(*it); | |||
| CustomData& cData(it.getValue()); | |||
| if (cData.type != nullptr) | |||
| { | |||
| @@ -48,7 +48,7 @@ lv2_atom_pad_size(uint32_t size) | |||
| static inline uint32_t | |||
| lv2_atom_total_size(const LV2_Atom* atom) | |||
| { | |||
| return sizeof(LV2_Atom) + atom->size; | |||
| return (uint32_t)sizeof(LV2_Atom) + atom->size; | |||
| } | |||
| /** Return true iff @p atom is null. */ | |||
| @@ -208,7 +208,7 @@ lv2_atom_object_next(const LV2_Atom_Property_Body* i) | |||
| const LV2_Atom* const value = (const LV2_Atom*)( | |||
| (const uint8_t*)i + 2 * sizeof(uint32_t)); | |||
| return (const LV2_Atom_Property_Body*)( | |||
| (const uint8_t*)i + lv2_atom_pad_size(sizeof(LV2_Atom_Property_Body) | |||
| (const uint8_t*)i + lv2_atom_pad_size((uint32_t)sizeof(LV2_Atom_Property_Body) | |||
| + value->size)); | |||
| } | |||
| @@ -146,9 +146,9 @@ typedef struct { | |||
| typedef struct { | |||
| uint8_t port; | |||
| uint32_t time; | |||
| uint8_t data[4]; | |||
| uint64_t time; | |||
| uint8_t size; | |||
| uint8_t data[4]; | |||
| } NativeMidiEvent; | |||
| typedef struct { | |||
| @@ -50,7 +50,7 @@ ALL_C_FLAGS += -DWANT_MIDIFILE | |||
| endif | |||
| ifeq ($(HAVE_ZYN_DEPS),true) | |||
| ZYN_CXX_FLAGS = $(BUILD_CXX_FLAGS) | |||
| ZYN_CXX_FLAGS = $(BUILD_CXX_FLAGS) -w | |||
| ZYN_CXX_FLAGS += $(shell pkg-config --cflags fftw3 mxml zlib) | |||
| LINK_FLAGS += $(shell pkg-config --libs fftw3 mxml zlib) | |||
| ifeq ($(HAVE_ZYN_UI_DEPS),true) | |||
| @@ -104,8 +104,8 @@ ifeq ($(HAVE_OPENGL),true) | |||
| OBJS += \ | |||
| distrho-3bandeq.cpp.o \ | |||
| distrho-3bandsplitter.cpp.o \ | |||
| distrho-nekobi.cpp.o \ | |||
| distrho-pingpongpan.cpp.o | |||
| # distrho-nekobi.cpp.o \ | |||
| # distrho-stereoenhancer.cpp.o | |||
| endif | |||
| @@ -97,7 +97,7 @@ void carla_register_all_plugins() | |||
| // DISTRHO plugins (OpenGL) | |||
| carla_register_native_plugin_3BandEQ(); | |||
| carla_register_native_plugin_3BandSplitter(); | |||
| carla_register_native_plugin_Nekobi(); | |||
| //carla_register_native_plugin_Nekobi(); | |||
| carla_register_native_plugin_PingPongPan(); | |||
| //carla_register_native_plugin_StereoEnhancer(); // unfinished | |||
| #endif | |||
| @@ -118,7 +118,7 @@ ssize_t ad_read_mono_dbl(void *sf, struct adinfo *nfo, double* d, size_t len){ | |||
| buf = (float*) realloc((void*)buf, bufsiz * sizeof(float)); | |||
| } | |||
| len = ad_read(sf, buf, bufsiz); | |||
| len = (size_t)ad_read(sf, buf, bufsiz); | |||
| for (f=0;f< (len/chn);f++) { | |||
| double val=0.0; | |||
| @@ -127,7 +127,7 @@ ssize_t ad_read_mono_dbl(void *sf, struct adinfo *nfo, double* d, size_t len){ | |||
| } | |||
| d[f]= val/chn; | |||
| } | |||
| return len/chn; | |||
| return (ssize_t)len/chn; | |||
| } | |||
| @@ -52,12 +52,12 @@ static int ad_info_sndfile(void *sf, struct adinfo *nfo) { | |||
| sndfile_audio_decoder *priv = (sndfile_audio_decoder*) sf; | |||
| if (!priv) return -1; | |||
| if (nfo) { | |||
| nfo->channels = priv->sfinfo.channels; | |||
| nfo->channels = (unsigned int)priv->sfinfo.channels; | |||
| nfo->frames = priv->sfinfo.frames; | |||
| nfo->sample_rate = priv->sfinfo.samplerate; | |||
| nfo->sample_rate = (unsigned int)priv->sfinfo.samplerate; | |||
| nfo->length = priv->sfinfo.samplerate ? (priv->sfinfo.frames * 1000) / priv->sfinfo.samplerate : 0; | |||
| nfo->bit_depth = parse_bit_depth(priv->sfinfo.format); | |||
| nfo->bit_rate = nfo->bit_depth * nfo->channels * nfo->sample_rate; | |||
| nfo->bit_rate = nfo->bit_depth * priv->sfinfo.channels * priv->sfinfo.samplerate; | |||
| nfo->meta_data = NULL; | |||
| } | |||
| return 0; | |||
| @@ -98,7 +98,7 @@ static int64_t ad_seek_sndfile(void *sf, int64_t pos) { | |||
| static ssize_t ad_read_sndfile(void *sf, float* d, size_t len) { | |||
| sndfile_audio_decoder *priv = (sndfile_audio_decoder*) sf; | |||
| if (!priv) return -1; | |||
| return sf_read_float (priv->sffile, d, len); | |||
| return sf_read_float (priv->sffile, d, (sf_count_t)len); | |||
| } | |||
| static int ad_eval_sndfile(const char *f) { | |||
| @@ -27,29 +27,23 @@ | |||
| #define MAX_PREALLOCATED_EVENT_COUNT 1000 | |||
| struct RawMidiEvent { | |||
| uint8_t data[MAX_EVENT_DATA_SIZE]; | |||
| uint64_t time; | |||
| uint8_t size; | |||
| uint32_t time; | |||
| uint8_t data[MAX_EVENT_DATA_SIZE]; | |||
| RawMidiEvent() | |||
| #ifdef CARLA_PROPER_CPP11_SUPPORT | |||
| : data{0}, | |||
| size(0), | |||
| time(0) {} | |||
| #else | |||
| : size(0), | |||
| time(0) | |||
| : time(0), | |||
| size(0) | |||
| { | |||
| carla_fill<uint8_t>(data, MAX_EVENT_DATA_SIZE, 0); | |||
| } | |||
| #endif | |||
| }; | |||
| class AbstractMidiPlayer | |||
| { | |||
| public: | |||
| virtual ~AbstractMidiPlayer() {} | |||
| virtual void writeMidiEvent(const uint32_t timePosFrame, const RawMidiEvent* const event) = 0; | |||
| virtual void writeMidiEvent(const uint64_t timePosFrame, const RawMidiEvent* const event) = 0; | |||
| }; | |||
| class MidiPattern | |||
| @@ -65,124 +59,124 @@ public: | |||
| ~MidiPattern() | |||
| { | |||
| fData.clear(); | |||
| fData.clear_const(); | |||
| } | |||
| void addControl(const uint32_t time, const uint8_t channel, const uint8_t control, const uint8_t value) | |||
| void addControl(const uint64_t time, const uint8_t channel, const uint8_t control, const uint8_t value) | |||
| { | |||
| RawMidiEvent* ctrlEvent(new RawMidiEvent()); | |||
| ctrlEvent->data[0] = MIDI_STATUS_CONTROL_CHANGE | (channel & 0x0F); | |||
| ctrlEvent->time = time; | |||
| ctrlEvent->size = 3; | |||
| ctrlEvent->data[0] = uint8_t(MIDI_STATUS_CONTROL_CHANGE | (channel & 0x0F)); | |||
| ctrlEvent->data[1] = control; | |||
| ctrlEvent->data[2] = value; | |||
| ctrlEvent->size = 3; | |||
| ctrlEvent->time = time; | |||
| append(ctrlEvent); | |||
| } | |||
| void addChannelPressure(const uint32_t time, const uint8_t channel, const uint8_t pressure) | |||
| void addChannelPressure(const uint64_t time, const uint8_t channel, const uint8_t pressure) | |||
| { | |||
| RawMidiEvent* pressureEvent(new RawMidiEvent()); | |||
| pressureEvent->data[0] = MIDI_STATUS_CHANNEL_PRESSURE | (channel & 0x0F); | |||
| pressureEvent->data[1] = pressure; | |||
| pressureEvent->size = 2; | |||
| pressureEvent->time = time; | |||
| pressureEvent->size = 2; | |||
| pressureEvent->data[0] = uint8_t(MIDI_STATUS_CHANNEL_PRESSURE | (channel & 0x0F)); | |||
| pressureEvent->data[1] = pressure; | |||
| append(pressureEvent); | |||
| } | |||
| void addNote(const uint32_t time, const uint8_t channel, const uint8_t pitch, const uint8_t velocity, const uint32_t duration) | |||
| void addNote(const uint64_t time, const uint8_t channel, const uint8_t pitch, const uint8_t velocity, const uint32_t duration) | |||
| { | |||
| addNoteOn(time, channel, pitch, velocity); | |||
| addNoteOff(time+duration, channel, pitch, velocity); | |||
| } | |||
| void addNoteOn(const uint32_t time, const uint8_t channel, const uint8_t pitch, const uint8_t velocity) | |||
| void addNoteOn(const uint64_t time, const uint8_t channel, const uint8_t pitch, const uint8_t velocity) | |||
| { | |||
| RawMidiEvent* noteOnEvent(new RawMidiEvent()); | |||
| noteOnEvent->data[0] = MIDI_STATUS_NOTE_ON | (channel & 0x0F); | |||
| noteOnEvent->time = time; | |||
| noteOnEvent->size = 3; | |||
| noteOnEvent->data[0] = uint8_t(MIDI_STATUS_NOTE_ON | (channel & 0x0F)); | |||
| noteOnEvent->data[1] = pitch; | |||
| noteOnEvent->data[2] = velocity; | |||
| noteOnEvent->size = 3; | |||
| noteOnEvent->time = time; | |||
| append(noteOnEvent); | |||
| } | |||
| void addNoteOff(const uint32_t time, const uint8_t channel, const uint8_t pitch, const uint8_t velocity = 0) | |||
| void addNoteOff(const uint64_t time, const uint8_t channel, const uint8_t pitch, const uint8_t velocity = 0) | |||
| { | |||
| RawMidiEvent* noteOffEvent(new RawMidiEvent()); | |||
| noteOffEvent->data[0] = MIDI_STATUS_NOTE_OFF | (channel & 0x0F); | |||
| noteOffEvent->time = time; | |||
| noteOffEvent->size = 3; | |||
| noteOffEvent->data[0] = uint8_t(MIDI_STATUS_NOTE_OFF | (channel & 0x0F)); | |||
| noteOffEvent->data[1] = pitch; | |||
| noteOffEvent->data[2] = velocity; | |||
| noteOffEvent->size = 3; | |||
| noteOffEvent->time = time; | |||
| append(noteOffEvent); | |||
| } | |||
| void addNoteAftertouch(const uint32_t time, const uint8_t channel, const uint8_t pitch, const uint8_t pressure) | |||
| void addNoteAftertouch(const uint64_t time, const uint8_t channel, const uint8_t pitch, const uint8_t pressure) | |||
| { | |||
| RawMidiEvent* noteAfterEvent(new RawMidiEvent()); | |||
| noteAfterEvent->data[0] = MIDI_STATUS_POLYPHONIC_AFTERTOUCH | (channel & 0x0F); | |||
| noteAfterEvent->time = time; | |||
| noteAfterEvent->size = 3; | |||
| noteAfterEvent->data[0] = uint8_t(MIDI_STATUS_POLYPHONIC_AFTERTOUCH | (channel & 0x0F)); | |||
| noteAfterEvent->data[1] = pitch; | |||
| noteAfterEvent->data[2] = pressure; | |||
| noteAfterEvent->size = 3; | |||
| noteAfterEvent->time = time; | |||
| append(noteAfterEvent); | |||
| } | |||
| void addProgram(const uint32_t time, const uint8_t channel, const uint8_t bank, const uint8_t program) | |||
| void addProgram(const uint64_t time, const uint8_t channel, const uint8_t bank, const uint8_t program) | |||
| { | |||
| RawMidiEvent* bankEvent(new RawMidiEvent()); | |||
| bankEvent->data[0] = MIDI_STATUS_CONTROL_CHANGE | (channel & 0x0F); | |||
| bankEvent->time = time; | |||
| bankEvent->size = 3; | |||
| bankEvent->data[0] = uint8_t(MIDI_STATUS_CONTROL_CHANGE | (channel & 0x0F)); | |||
| bankEvent->data[1] = MIDI_CONTROL_BANK_SELECT; | |||
| bankEvent->data[2] = bank; | |||
| bankEvent->size = 3; | |||
| bankEvent->time = time; | |||
| RawMidiEvent* programEvent(new RawMidiEvent()); | |||
| programEvent->data[0] = MIDI_STATUS_PROGRAM_CHANGE | (channel & 0x0F); | |||
| programEvent->data[1] = program; | |||
| programEvent->size = 2; | |||
| programEvent->time = time; | |||
| programEvent->size = 2; | |||
| programEvent->data[0] = uint8_t(MIDI_STATUS_PROGRAM_CHANGE | (channel & 0x0F)); | |||
| programEvent->data[1] = program; | |||
| append(bankEvent); | |||
| append(programEvent); | |||
| } | |||
| void addPitchbend(const uint32_t time, const uint8_t channel, const uint8_t lsb, const uint8_t msb) | |||
| void addPitchbend(const uint64_t time, const uint8_t channel, const uint8_t lsb, const uint8_t msb) | |||
| { | |||
| RawMidiEvent* pressureEvent(new RawMidiEvent()); | |||
| pressureEvent->data[0] = MIDI_STATUS_PITCH_WHEEL_CONTROL | (channel & 0x0F); | |||
| pressureEvent->time = time; | |||
| pressureEvent->size = 3; | |||
| pressureEvent->data[0] = uint8_t(MIDI_STATUS_PITCH_WHEEL_CONTROL | (channel & 0x0F)); | |||
| pressureEvent->data[1] = lsb; | |||
| pressureEvent->data[2] = msb; | |||
| pressureEvent->size = 3; | |||
| pressureEvent->time = time; | |||
| append(pressureEvent); | |||
| } | |||
| void addRaw(const uint32_t time, const uint8_t* data, const uint8_t size) | |||
| void addRaw(const uint64_t time, const uint8_t* data, const uint8_t size) | |||
| { | |||
| RawMidiEvent* rawEvent(new RawMidiEvent()); | |||
| rawEvent->size = size; | |||
| rawEvent->time = time; | |||
| rawEvent->time = time; | |||
| rawEvent->size = size; | |||
| carla_copy<uint8_t>(rawEvent->data, data, size); | |||
| append(rawEvent); | |||
| } | |||
| void play(uint32_t timePosFrame, uint32_t frames) | |||
| void play(uint64_t timePosFrame, uint32_t frames) | |||
| { | |||
| if (! fMutex.tryLock()) | |||
| return; | |||
| for (List<const RawMidiEvent*>::Itenerator it = fData.begin(); it.valid(); it.next()) | |||
| { | |||
| const RawMidiEvent* const rawMidiEvent(*it); | |||
| const RawMidiEvent* const rawMidiEvent(it.getConstValue()); | |||
| if (timePosFrame > rawMidiEvent->time) | |||
| continue; | |||
| @@ -198,7 +192,7 @@ public: | |||
| void clear() | |||
| { | |||
| const CarlaMutex::ScopedLocker sl(fMutex); | |||
| fData.clear(); | |||
| fData.clear_const(); | |||
| } | |||
| private: | |||
| @@ -221,7 +215,7 @@ private: | |||
| for (List<const RawMidiEvent*>::Itenerator it = fData.begin(); it.valid(); it.next()) | |||
| { | |||
| const RawMidiEvent* const oldEvent(*it); | |||
| const RawMidiEvent* const oldEvent(it.getConstValue()); | |||
| if (event->time >= oldEvent->time) | |||
| continue; | |||
| @@ -75,7 +75,7 @@ protected: | |||
| for (int i=0; i < MAX_MIDI_CHANNELS; ++i) | |||
| { | |||
| midiEvent.data[0] = MIDI_STATUS_CONTROL_CHANGE+i; | |||
| midiEvent.data[0] = uint8_t(MIDI_STATUS_CONTROL_CHANGE+i); | |||
| NativePluginClass::writeMidiEvent(&midiEvent); | |||
| } | |||
| @@ -104,17 +104,17 @@ protected: | |||
| // ------------------------------------------------------------------- | |||
| // AbstractMidiPlayer calls | |||
| void writeMidiEvent(const uint32_t timePosFrame, const RawMidiEvent* const event) override | |||
| void writeMidiEvent(const uint64_t timePosFrame, const RawMidiEvent* const event) override | |||
| { | |||
| NativeMidiEvent midiEvent; | |||
| midiEvent.port = 0; | |||
| midiEvent.time = event->time-timePosFrame; | |||
| midiEvent.size = event->size; | |||
| midiEvent.data[0] = event->data[0]; | |||
| midiEvent.data[1] = event->data[1]; | |||
| midiEvent.data[2] = event->data[2]; | |||
| midiEvent.data[3] = event->data[3]; | |||
| midiEvent.size = event->size; | |||
| NativePluginClass::writeMidiEvent(&midiEvent); | |||
| } | |||
| @@ -145,10 +145,10 @@ private: | |||
| if (event->midi_buffer_length <= 0 || event->midi_buffer_length > MAX_EVENT_DATA_SIZE) | |||
| continue; | |||
| const uint32_t time(event->time_seconds*sampleRate); | |||
| const uint64_t time(uint64_t(event->time_seconds*sampleRate)); | |||
| #if 1 | |||
| fMidiOut.addRaw(time, event->midi_buffer, event->midi_buffer_length); | |||
| fMidiOut.addRaw(time, event->midi_buffer, uint8_t(event->midi_buffer_length)); | |||
| #else | |||
| const uint8_t status = MIDI_GET_STATUS_FROM_DATA(event->midi_buffer); | |||
| const uint8_t channel = MIDI_GET_CHANNEL_FROM_DATA(event->midi_buffer); | |||
| @@ -92,7 +92,7 @@ public: | |||
| for (auto it = fPrograms.begin(); it.valid(); it.next()) | |||
| { | |||
| const ProgramInfo*& pInfo(*it); | |||
| const ProgramInfo* const& pInfo(it.getConstValue()); | |||
| delete pInfo; | |||
| } | |||
| @@ -477,7 +477,7 @@ public: | |||
| for (size_t i=0; i < fBufferLen; ++i) | |||
| { | |||
| if (fBuffer[i] >= 'A' && fBuffer[i] <= 'Z') | |||
| fBuffer[i] += kCharDiff; | |||
| fBuffer[i] = static_cast<char>(fBuffer[i] + kCharDiff); | |||
| } | |||
| } | |||
| @@ -491,7 +491,7 @@ public: | |||
| for (size_t i=0; i < fBufferLen; ++i) | |||
| { | |||
| if (fBuffer[i] >= 'a' && fBuffer[i] <= 'z') | |||
| fBuffer[i] -= kCharDiff; | |||
| fBuffer[i] = static_cast<char>(fBuffer[i] - kCharDiff); | |||
| } | |||
| } | |||
| @@ -8,8 +8,8 @@ include ../../../Makefile.mk | |||
| # -------------------------------------------------------------- | |||
| BUILD_C_FLAGS += $(DGL_FLAGS) -I. | |||
| BUILD_CXX_FLAGS += $(DGL_FLAGS) -I. | |||
| BUILD_C_FLAGS += $(DGL_FLAGS) -I. -w | |||
| BUILD_CXX_FLAGS += $(DGL_FLAGS) -I. -w | |||
| LINK_FLAGS += $(DGL_LIBS) | |||
| OBJS = \ | |||
| @@ -8,7 +8,7 @@ include ../../Makefile.mk | |||
| # -------------------------------------------------------------- | |||
| BUILD_CXX_FLAGS += $(JUCE_AUDIO_BASICS_FLAGS) -I. | |||
| BUILD_CXX_FLAGS += $(JUCE_AUDIO_BASICS_FLAGS) -I. -w | |||
| LINK_FLAGS += $(JUCE_AUDIO_BASICS_LIBS) -L.. -ljuce_core | |||
| ifeq ($(MACOS),true) | |||
| @@ -8,7 +8,7 @@ include ../../Makefile.mk | |||
| # -------------------------------------------------------------- | |||
| BUILD_CXX_FLAGS += $(JUCE_CORE_FLAGS) -I. | |||
| BUILD_CXX_FLAGS += $(JUCE_CORE_FLAGS) -I. -w | |||
| LINK_FLAGS += $(JUCE_CORE_LIBS) | |||
| ifeq ($(MACOS),true) | |||
| @@ -8,7 +8,7 @@ include ../../Makefile.mk | |||
| # -------------------------------------------------------------- | |||
| BUILD_CXX_FLAGS += $(JUCE_EVENTS_FLAGS) -I. | |||
| BUILD_CXX_FLAGS += $(JUCE_EVENTS_FLAGS) -I. -w | |||
| LINK_FLAGS += $(JUCE_EVENTS_LIBS) -L.. -ljuce_core | |||
| ifeq ($(MACOS),true) | |||
| @@ -8,7 +8,7 @@ include ../../Makefile.mk | |||
| # -------------------------------------------------------------- | |||
| BUILD_CXX_FLAGS += $(JUCE_GRAPHICS_FLAGS) -I. | |||
| BUILD_CXX_FLAGS += $(JUCE_GRAPHICS_FLAGS) -I. -w | |||
| LINK_FLAGS += $(JUCE_GRAPHICS_LIBS) -L.. -ljuce_events -ljuce_core | |||
| ifeq ($(MACOS),true) | |||
| @@ -8,7 +8,7 @@ include ../../Makefile.mk | |||
| # -------------------------------------------------------------- | |||
| BUILD_CXX_FLAGS += $(JUCE_GUI_BASICS_FLAGS) -I. | |||
| BUILD_CXX_FLAGS += $(JUCE_GUI_BASICS_FLAGS) -I. -w | |||
| LINK_FLAGS += $(JUCE_GUI_BASICS_LIBS) -L.. -ljuce_data_structures -ljuce_graphics -ljuce_events -ljuce_core | |||
| ifeq ($(MACOS),true) | |||
| @@ -53,6 +53,10 @@ | |||
| const typeof( ((type *)0)->member ) *__mptr = (ptr); \ | |||
| (type *)( (char *)__mptr - offsetof(type, member) );}) | |||
| #define container_of_const(ptr, type, member) ({ \ | |||
| const typeof( ((type *)0)->member ) *__mptr = (ptr); \ | |||
| (const type *)( (const char *)__mptr - offsetof(type, member) );}) | |||
| #define prefetch(x) (x = x) | |||
| /* | |||
| @@ -303,9 +307,13 @@ static inline void list_splice_tail_init(struct list_head *list, struct list_hea | |||
| #if defined(__GNUC__) && ! (defined(BUILD_ANSI_TEST) || defined(QTCREATOR_TEST)) | |||
| # define list_entry(ptr, type, member) \ | |||
| container_of(ptr, type, member) | |||
| # define list_entry_const(ptr, type, member) \ | |||
| container_of_const(ptr, type, member) | |||
| #else | |||
| # define list_entry(ptr, type, member) \ | |||
| ((type *)((char *)(ptr)-offsetof(type, member))) | |||
| # define list_entry_const(ptr, type, member) \ | |||
| ((const type *)((const char *)(ptr)-offsetof(type, member))) | |||
| #endif | |||
| /** | |||
| @@ -10,21 +10,21 @@ BUILD_CXX_FLAGS += -I../includes -I../utils -isystem ../modules | |||
| # -------------------------------------------------------------- | |||
| # ifeq ($(HAVE_OPENGL),true) | |||
| # BUILD_CXX_FLAGS += -DWANT_OPENGL | |||
| # endif | |||
| # | |||
| # ifeq ($(HAVE_AF_DEPS),true) | |||
| # BUILD_CXX_FLAGS += -DWANT_AUDIOFILE | |||
| # endif | |||
| # | |||
| # ifeq ($(HAVE_MF_DEPS),true) | |||
| # BUILD_CXX_FLAGS += -DWANT_MIDIFILE | |||
| # endif | |||
| # | |||
| # ifeq ($(HAVE_ZYN_DEPS),true) | |||
| # BUILD_CXX_FLAGS += -DWANT_ZYNADDSUBFX | |||
| # endif | |||
| ifeq ($(HAVE_OPENGL),true) | |||
| BUILD_CXX_FLAGS += -DWANT_OPENGL | |||
| endif | |||
| ifeq ($(HAVE_AF_DEPS),true) | |||
| BUILD_CXX_FLAGS += -DWANT_AUDIOFILE | |||
| endif | |||
| ifeq ($(HAVE_MF_DEPS),true) | |||
| BUILD_CXX_FLAGS += -DWANT_MIDIFILE | |||
| endif | |||
| ifeq ($(HAVE_ZYN_DEPS),true) | |||
| BUILD_CXX_FLAGS += -DWANT_ZYNADDSUBFX | |||
| endif | |||
| # -------------------------------------------------------------- | |||
| # Common | |||
| @@ -45,38 +45,38 @@ BUILD_CXX_FLAGS += -I../includes -I../utils -isystem ../modules | |||
| # -------------------------------------------------------------- | |||
| # Native | |||
| # ifeq ($(HAVE_AF_DEPS),true) | |||
| # LINK_FLAGS += $(shell pkg-config --libs sndfile) | |||
| # ifeq ($(HAVE_FFMPEG),true) | |||
| # LINK_FLAGS += $(shell pkg-config --libs libavcodec libavformat libavutil) | |||
| # endif | |||
| # endif | |||
| # | |||
| # ifeq ($(HAVE_MF_DEPS),true) | |||
| # LINK_FLAGS += $(shell pkg-config --libs smf) | |||
| # endif | |||
| # | |||
| # ifeq ($(HAVE_ZYN_DEPS),true) | |||
| # LINK_FLAGS += $(shell pkg-config --libs fftw3 mxml zlib) | |||
| # ifeq ($(HAVE_ZYN_UI_DEPS),true) | |||
| # LINK_FLAGS += $(shell pkg-config --libs ntk_images ntk) | |||
| # endif | |||
| # endif | |||
| ifeq ($(HAVE_AF_DEPS),true) | |||
| LINK_FLAGS += $(shell pkg-config --libs sndfile) | |||
| ifeq ($(HAVE_FFMPEG),true) | |||
| LINK_FLAGS += $(shell pkg-config --libs libavcodec libavformat libavutil) | |||
| endif | |||
| endif | |||
| ifeq ($(HAVE_MF_DEPS),true) | |||
| LINK_FLAGS += $(shell pkg-config --libs smf) | |||
| endif | |||
| ifeq ($(HAVE_ZYN_DEPS),true) | |||
| LINK_FLAGS += $(shell pkg-config --libs fftw3 mxml zlib) | |||
| ifeq ($(HAVE_ZYN_UI_DEPS),true) | |||
| LINK_FLAGS += $(shell pkg-config --libs ntk_images ntk) | |||
| endif | |||
| endif | |||
| # -------------------------------------------------------------- | |||
| # Libs | |||
| # LINK_FLAGS += $(JUCE_AUDIO_BASICS_LIBS) | |||
| # LINK_FLAGS += $(JUCE_CORE_LIBS) | |||
| LINK_FLAGS += $(JUCE_AUDIO_BASICS_LIBS) | |||
| LINK_FLAGS += $(JUCE_CORE_LIBS) | |||
| # LINK_FLAGS += $(JUCE_DATA_STRUCTURES_LIBS) | |||
| # LINK_FLAGS += $(JUCE_EVENTS_LIBS) | |||
| LINK_FLAGS += $(JUCE_EVENTS_LIBS) | |||
| # LINK_FLAGS += $(JUCE_GRAPHICS_LIBS) | |||
| # LINK_FLAGS += $(JUCE_GUI_BASICS_LIBS) | |||
| LINK_FLAGS += $(RTMEMPOOL_LIBS) | |||
| # ifeq ($(HAVE_OPENGL),true) | |||
| # LINK_FLAGS += $(DGL_LIBS) | |||
| # endif | |||
| ifeq ($(HAVE_OPENGL),true) | |||
| LINK_FLAGS += $(DGL_LIBS) | |||
| endif | |||
| # ifeq ($(CARLA_PLUGIN_SUPPORT),true) | |||
| # LINK_FLAGS += $(LILV_LIBS) | |||
| @@ -85,17 +85,17 @@ LINK_FLAGS += $(RTMEMPOOL_LIBS) | |||
| # -------------------------------------------------------------- | |||
| LIBS = ../modules/carla_native.a | |||
| # LIBS += ../modules/juce_audio_basics.a | |||
| # LIBS += ../modules/juce_core.a | |||
| LIBS += ../modules/juce_audio_basics.a | |||
| LIBS += ../modules/juce_core.a | |||
| # LIBS += ../modules/juce_data_structures.a | |||
| # LIBS += ../modules/juce_events.a | |||
| LIBS += ../modules/juce_events.a | |||
| # LIBS += ../modules/juce_graphics.a | |||
| # LIBS += ../modules/juce_gui_basics.a | |||
| LIBS += ../modules/rtmempool.a | |||
| # ifeq ($(HAVE_OPENGL),true) | |||
| # LIBS += ../modules/dgl.a | |||
| # endif | |||
| ifeq ($(HAVE_OPENGL),true) | |||
| LIBS += ../modules/dgl.a | |||
| endif | |||
| # ifeq ($(CARLA_PLUGIN_SUPPORT),true) | |||
| # LIBS += ../modules/lilv.a | |||
| @@ -33,7 +33,7 @@ struct PluginListManager { | |||
| { | |||
| for (List<const LV2_Descriptor*>::Itenerator it = lv2Descs.begin(); it.valid(); it.next()) | |||
| { | |||
| const LV2_Descriptor*& lv2Desc(*it); | |||
| const LV2_Descriptor*& lv2Desc(it.getValue()); | |||
| delete[] lv2Desc->URI; | |||
| delete lv2Desc; | |||
| } | |||
| @@ -116,7 +116,7 @@ void writeManifestFile() | |||
| for (List<const NativePluginDescriptor*>::Itenerator it = sPluginDescsMgr.descs.begin(); it.valid(); it.next()) | |||
| { | |||
| const NativePluginDescriptor*& pluginDesc(*it); | |||
| const NativePluginDescriptor* const& pluginDesc(it.getConstValue()); | |||
| const String label(pluginDesc->label); | |||
| if (label == "carla") | |||
| @@ -566,7 +566,7 @@ int main() | |||
| for (List<const NativePluginDescriptor*>::Itenerator it = sPluginDescsMgr.descs.begin(); it.valid(); it.next()) | |||
| { | |||
| const NativePluginDescriptor*& pluginDesc(*it); | |||
| const NativePluginDescriptor* const& pluginDesc(it.getConstValue()); | |||
| writePluginFile(pluginDesc); | |||
| } | |||
| @@ -325,7 +325,7 @@ public: | |||
| fMidiEvents[fMidiEventCount].port = 0; | |||
| fMidiEvents[fMidiEventCount].time = event->time.frames; | |||
| fMidiEvents[fMidiEventCount].size = event->body.size; | |||
| fMidiEvents[fMidiEventCount].size = (uint8_t)event->body.size; | |||
| for (uint32_t i=0; i < event->body.size; ++i) | |||
| fMidiEvents[fMidiEventCount].data[i] = data[i]; | |||
| @@ -336,7 +336,7 @@ public: | |||
| if (event->body.type == fUris.atomBlank) | |||
| { | |||
| const LV2_Atom_Object* const obj((LV2_Atom_Object*)&event->body); | |||
| const LV2_Atom_Object* const obj((const LV2_Atom_Object*)&event->body); | |||
| if (obj->body.otype != fUris.timePos) | |||
| continue; | |||
| @@ -415,9 +415,9 @@ public: | |||
| const uint8_t* const data((const uint8_t*)(event + 1)); | |||
| fMidiEvents[fMidiEventCount].port = i; | |||
| fMidiEvents[fMidiEventCount].port = (uint8_t)i; | |||
| fMidiEvents[fMidiEventCount].size = (uint8_t)event->body.size; | |||
| fMidiEvents[fMidiEventCount].time = event->time.frames; | |||
| fMidiEvents[fMidiEventCount].size = event->body.size; | |||
| for (uint32_t j=0; j < event->body.size; ++j) | |||
| fMidiEvents[fMidiEventCount].data[j] = data[j]; | |||
| @@ -482,7 +482,7 @@ public: | |||
| fSampleRate = *(const double*)options[i].value; | |||
| if (fDescriptor->dispatcher != nullptr) | |||
| fDescriptor->dispatcher(fHandle, PLUGIN_OPCODE_SAMPLE_RATE_CHANGED, 0, 0, nullptr, fSampleRate); | |||
| fDescriptor->dispatcher(fHandle, PLUGIN_OPCODE_SAMPLE_RATE_CHANGED, 0, 0, nullptr, (float)fSampleRate); | |||
| } | |||
| else | |||
| carla_stderr("Host changed sampleRate but with wrong value type"); | |||
| @@ -1194,7 +1194,7 @@ static LV2_Handle lv2_instantiate(const LV2_Descriptor* lv2Descriptor, double sa | |||
| for (List<const NativePluginDescriptor*>::Itenerator it = sPluginDescsMgr.descs.begin(); it.valid(); it.next()) | |||
| { | |||
| const NativePluginDescriptor*& tmpDesc(*it); | |||
| const NativePluginDescriptor* const& tmpDesc(it.getConstValue()); | |||
| if (std::strcmp(tmpDesc->label, pluginLabel) == 0) | |||
| { | |||
| @@ -37,7 +37,7 @@ public: | |||
| for (List<Lib>::Itenerator it = fLibs.begin(); it.valid(); it.next()) | |||
| { | |||
| Lib& lib(*it); | |||
| Lib& lib(it.getValue()); | |||
| CARLA_ASSERT(lib.count > 0); | |||
| CARLA_SAFE_ASSERT_CONTINUE(lib.filename != nullptr); | |||
| @@ -71,7 +71,7 @@ public: | |||
| for (List<Lib>::Itenerator it = fLibs.begin(); it.valid(); it.next()) | |||
| { | |||
| Lib& lib(*it); | |||
| Lib& lib(it.getValue()); | |||
| CARLA_ASSERT(lib.count > 0); | |||
| CARLA_SAFE_ASSERT_CONTINUE(lib.lib != nullptr); | |||
| @@ -194,13 +194,13 @@ struct SaveState { | |||
| for (StateParameterItenerator it = parameters.begin(); it.valid(); it.next()) | |||
| { | |||
| StateParameter* const stateParameter(*it); | |||
| StateParameter* const stateParameter(it.getValue()); | |||
| delete stateParameter; | |||
| } | |||
| for (StateCustomDataItenerator it = customData.begin(); it.valid(); it.next()) | |||
| { | |||
| StateCustomData* const stateCustomData(*it); | |||
| StateCustomData* const stateCustomData(it.getValue()); | |||
| delete stateCustomData; | |||
| } | |||
| @@ -530,7 +530,7 @@ void fillXmlStringFromSaveState(QString& content, const SaveState& saveState) | |||
| for (StateParameterItenerator it = saveState.parameters.begin(); it.valid(); it.next()) | |||
| { | |||
| StateParameter* const stateParameter(*it); | |||
| StateParameter* const stateParameter(it.getValue()); | |||
| QString parameter("\n"" <Parameter>\n"); | |||
| @@ -577,7 +577,7 @@ void fillXmlStringFromSaveState(QString& content, const SaveState& saveState) | |||
| for (StateCustomDataItenerator it = saveState.customData.begin(); it.valid(); it.next()) | |||
| { | |||
| StateCustomData* const stateCustomData(*it); | |||
| StateCustomData* const stateCustomData(it.getValue()); | |||
| QString customData("\n"" <CustomData>\n"); | |||
| customData += QString(" <Type>%1</Type>\n").arg(xmlSafeString(stateCustomData->type, true)); | |||
| @@ -477,7 +477,6 @@ public: | |||
| */ | |||
| void toLower() noexcept | |||
| { | |||
| // Using '+=' temporarily converts char into int | |||
| static const char kCharDiff('a' - 'A'); | |||
| for (size_t i=0; i < fBufferLen; ++i) | |||
| @@ -492,7 +491,6 @@ public: | |||
| */ | |||
| void toUpper() noexcept | |||
| { | |||
| // Using '-=' temporarily converts char into int | |||
| static const char kCharDiff('a' - 'A'); | |||
| for (size_t i=0; i < fBufferLen; ++i) | |||
| @@ -71,10 +71,10 @@ public: | |||
| class Itenerator { | |||
| public: | |||
| Itenerator(const k_list_head* queue) | |||
| : fData(nullptr), | |||
| fEntry(queue->next), | |||
| : fEntry(queue->next), | |||
| fEntry2(fEntry->next), | |||
| fQueue(queue) | |||
| fQueue(queue), | |||
| fData(nullptr) | |||
| { | |||
| CARLA_ASSERT(fEntry != nullptr); | |||
| CARLA_ASSERT(fEntry2 != nullptr); | |||
| @@ -92,19 +92,37 @@ public: | |||
| fEntry2 = fEntry->next; | |||
| } | |||
| T& operator*() | |||
| T& getValue() | |||
| { | |||
| fData = list_entry(fEntry, Data, siblings); | |||
| CARLA_ASSERT(fData != nullptr); | |||
| return fData->value; | |||
| } | |||
| const T& getConstValue() | |||
| { | |||
| fConstData = list_entry_const(fEntry, Data, siblings); | |||
| CARLA_ASSERT(fConstData != nullptr); | |||
| return fConstData->value; | |||
| } | |||
| #if 0 | |||
| T& operator*() const | |||
| { | |||
| return getValue(); | |||
| } | |||
| #endif | |||
| private: | |||
| Data* fData; | |||
| k_list_head* fEntry; | |||
| k_list_head* fEntry2; | |||
| const k_list_head* const fQueue; | |||
| union { | |||
| Data* fData; | |||
| const Data* fConstData; | |||
| }; | |||
| friend class AbstractList; | |||
| }; | |||
| @@ -133,6 +151,35 @@ public: | |||
| _init(); | |||
| } | |||
| // temporary fix for some const issue in midi-base.hpp | |||
| void clear_const() | |||
| { | |||
| if (fCount != 0) | |||
| { | |||
| k_list_head* entry; | |||
| k_list_head* entry2; | |||
| list_for_each_safe(entry, entry2, &fQueue) | |||
| { | |||
| if (const Data* data = list_entry_const(entry, Data, siblings)) | |||
| { | |||
| data->~Data(); | |||
| union CData { | |||
| const Data* cdata; | |||
| Data* data; | |||
| }; | |||
| CData d; | |||
| d.cdata = data; | |||
| _deallocate(d.data); | |||
| } | |||
| } | |||
| } | |||
| _init(); | |||
| } | |||
| size_t count() const noexcept | |||
| { | |||
| return fCount; | |||
| @@ -249,17 +296,15 @@ public: | |||
| void remove(Itenerator& it) | |||
| { | |||
| CARLA_ASSERT(it.fEntry != nullptr); | |||
| CARLA_ASSERT(it.fData != nullptr); | |||
| CARLA_SAFE_ASSERT_RETURN(it.fEntry != nullptr,); | |||
| if (it.fEntry != nullptr && it.fData != nullptr) | |||
| { | |||
| --fCount; | |||
| list_del(it.fEntry); | |||
| --fCount; | |||
| list_del(it.fEntry); | |||
| it.fData->~Data(); | |||
| _deallocate(it.fData); | |||
| } | |||
| CARLA_SAFE_ASSERT_RETURN(it.fData != nullptr,); | |||
| it.fData->~Data(); | |||
| _deallocate(it.fData); | |||
| } | |||
| bool removeOne(const T& value) | |||