Browse Source

Removed confusing enums from HeapBlock. Fixed warnings in win32 midi.

tags/2021-05-28
jules 13 years ago
parent
commit
e89983a1ab
2 changed files with 11 additions and 18 deletions
  1. +5
    -5
      modules/juce_audio_devices/native/juce_win32_Midi.cpp
  2. +6
    -13
      modules/juce_core/memory/juce_HeapBlock.h

+ 5
- 5
modules/juce_audio_devices/native/juce_win32_Midi.cpp View File

@@ -199,18 +199,18 @@ private:
double convertTimeStamp (uint32 timeStamp)
{
timeStamp += startTime;
double t = startTime + timeStamp;
const double now = Time::getMillisecondCounterHiRes();
if (timeStamp > now)
if (t > now)
{
if (timeStamp > now + 2.0)
if (t > now + 2.0)
startTime -= 1.0;
timeStamp = now;
t = now;
}
return timeStamp * 0.001;
return t * 0.001;
}
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MidiInCollector);


+ 6
- 13
modules/juce_core/memory/juce_HeapBlock.h View File

@@ -87,13 +87,6 @@ template <class ElementType, bool throwOnFailure = false>
class HeapBlock
{
public:
/** Flags used to indicate whether a newly allocated block should be cleared or not. */
enum InitialisationState
{
leaveUnitialised = 0,
clearToZero
};
//==============================================================================
/** Creates a HeapBlock which is initially just a null pointer.
@@ -120,13 +113,13 @@ public:
/** Creates a HeapBlock containing a number of elements.
The initState parameter determines whether the new memory should be cleared, or
left uninitialised.
The initialiseToZero parameter determines whether the new memory should be cleared,
or left uninitialised.
*/
HeapBlock (const size_t numElements, InitialisationState initState)
: data (static_cast <ElementType*> (initState == leaveUnitialised
? std::malloc (numElements * sizeof (ElementType))
: std::calloc (numElements, sizeof (ElementType))))
HeapBlock (const size_t numElements, const bool initialiseToZero)
: data (static_cast <ElementType*> (initialiseToZero
? std::calloc (numElements, sizeof (ElementType))
: std::malloc (numElements * sizeof (ElementType))))
{
throwOnAllocationFailure();
}


Loading…
Cancel
Save