logo
down
shadow

Creating a simple VS2008 visualizer inside autoexp.dat (problem with casting)


Creating a simple VS2008 visualizer inside autoexp.dat (problem with casting)

Content Index :

Creating a simple VS2008 visualizer inside autoexp.dat (problem with casting)
Tag : cpp , By : Stephen Judge
Date : January 02 2021, 06:48 AM


Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

Tutorial/Manual how to create Visualizer in autoexp.dat


Tag : cpp , By : CM.
Date : March 29 2020, 07:55 AM
like below fixes the issue Appears this is already commented above but someone coming to this question would not necessarily read the comments and so might miss the great tutorial available on the boost site:
https://svn.boost.org/trac/boost/wiki/DebuggerVisualizers

Multidimensional array visualizer for Visual Studio using autoexp.dat


Tag : visual-studio , By : FarmerDave
Date : March 29 2020, 07:55 AM
wish of those help So I discovered the rank, and base expressions as described here. Got it working. Not a fancy list...but it works.
   MyClass<*>{
      children
       (
          #array
          (
            rank: 2,
            base: 0,
            expr: $e.v[($i % $e.nRow)][($i - $i % $e.nRow)/$e.nRow],
            size: ($r==1)*$e.nRow+($r==0)*$e.nCol
          )
       )
    }

Android Visualizer Detect Beat? And Visualizer.setCaptureSize() not Working? Alternatives?


Tag : android , By : meehan
Date : March 29 2020, 07:55 AM
seems to work fine Ok after several Hours of Testing and Researching I have found a solution. It may not be very accurate, but it is the only alternative I could come up with. I made a class called BeatDetector:
public class BeatDetectorByFrequency {
private static final String TAG = "TEST";

private Visualizer mVisualizer = null;

private double mRunningSoundAvg[];
private double mCurrentAvgEnergyOneSec[];
private int mNumberOfSamplesInOneSec;
private long mSystemTimeStartSec;
// FREQS
private static final int LOW_FREQUENCY = 300;
private static final int MID_FREQUENCY = 2500;
private static final int HIGH_FREQUENCY = 10000;
private OnBeatDetectedListener onBeatDetectedListener = null;

public BeatDetectorByFrequency() {
    init();
}

private void init() {
    mRunningSoundAvg = new double[3];
    mCurrentAvgEnergyOneSec = new double[3];
    mCurrentAvgEnergyOneSec[0] = -1;
    mCurrentAvgEnergyOneSec[1] = -1;
    mCurrentAvgEnergyOneSec[2] = -1;
}

public void link(MediaPlayer player) {
    if (player == null) {
        throw new NullPointerException("Cannot link to null MediaPlayer");
    }
    mVisualizer = new Visualizer(player.getAudioSessionId());
    mVisualizer.setCaptureSize(Visualizer.getCaptureSizeRange()[1]);

    Visualizer.OnDataCaptureListener captureListener = new Visualizer.OnDataCaptureListener() {
        @Override
        public void onWaveFormDataCapture(Visualizer visualizer,
                byte[] bytes, int samplingRate) {
            // DO NOTHING
        }

        @Override
        public void onFftDataCapture(Visualizer visualizer, byte[] bytes,
                int samplingRate) {
            updateVisualizerFFT(bytes);
        }
    };

    mVisualizer.setDataCaptureListener(captureListener,
            Visualizer.getMaxCaptureRate() / 2, false, true);
    mVisualizer.setEnabled(true);
    player.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
        @Override
        public void onCompletion(MediaPlayer mediaPlayer) {
            mVisualizer.setEnabled(false);
        }
    });
    mSystemTimeStartSec = System.currentTimeMillis();
}

public void release() {
    if (mVisualizer != null) {
        mVisualizer.setEnabled(false);
        mVisualizer.release();
    }
}

public void pause() {
    if (mVisualizer != null) {
        mVisualizer.setEnabled(false);
    }
}

public void resume() {
    if (mVisualizer != null) {
        mVisualizer.setEnabled(true);
    }
}

public void updateVisualizerFFT(byte[] audioBytes) {
    int energySum = 0;
    energySum += Math.abs(audioBytes[0]);
    int k = 2;
    double captureSize = mVisualizer.getCaptureSize() / 2;
    int sampleRate = mVisualizer.getSamplingRate() / 2000;
    double nextFrequency = ((k / 2) * sampleRate) / (captureSize);
    while (nextFrequency < LOW_FREQUENCY) {
        energySum += Math.sqrt((audioBytes[k] * audioBytes[k])
                * (audioBytes[k + 1] * audioBytes[k + 1]));
        k += 2;
        nextFrequency = ((k / 2) * sampleRate) / (captureSize);
    }
    double sampleAvgAudioEnergy = (double) energySum
            / (double) ((k * 1.0) / 2.0);

    mRunningSoundAvg[0] += sampleAvgAudioEnergy;
    if ((sampleAvgAudioEnergy > mCurrentAvgEnergyOneSec[0])
            && (mCurrentAvgEnergyOneSec[0] > 0)) {
        fireBeatDetectedLowEvent(sampleAvgAudioEnergy);
    }
    energySum = 0;
    while (nextFrequency < MID_FREQUENCY) {
        energySum += Math.sqrt((audioBytes[k] * audioBytes[k])
                * (audioBytes[k + 1] * audioBytes[k + 1]));
        k += 2;
        nextFrequency = ((k / 2) * sampleRate) / (captureSize);
    }

    sampleAvgAudioEnergy = (double) energySum / (double) ((k * 1.0) / 2.0);
    mRunningSoundAvg[1] += sampleAvgAudioEnergy;
    if ((sampleAvgAudioEnergy > mCurrentAvgEnergyOneSec[1])
            && (mCurrentAvgEnergyOneSec[1] > 0)) {
        fireBeatDetectedMidEvent(sampleAvgAudioEnergy);
    }
    energySum = Math.abs(audioBytes[1]);

    while ((nextFrequency < HIGH_FREQUENCY) && (k < audioBytes.length)) {
        energySum += Math.sqrt((audioBytes[k] * audioBytes[k])
                * (audioBytes[k + 1] * audioBytes[k + 1]));
        k += 2;
        nextFrequency = ((k / 2) * sampleRate) / (captureSize);
    }

    sampleAvgAudioEnergy = (double) energySum / (double) ((k * 1.0) / 2.0);
    mRunningSoundAvg[2] += sampleAvgAudioEnergy;
    if ((sampleAvgAudioEnergy > mCurrentAvgEnergyOneSec[2])
            && (mCurrentAvgEnergyOneSec[2] > 0)) {
        fireBeatDetectedHighEvent(sampleAvgAudioEnergy);
    }

    mNumberOfSamplesInOneSec++;
    if ((System.currentTimeMillis() - mSystemTimeStartSec) > 1000) {
        mCurrentAvgEnergyOneSec[0] = mRunningSoundAvg[0]
                / mNumberOfSamplesInOneSec;
        mCurrentAvgEnergyOneSec[1] = mRunningSoundAvg[1]
                / mNumberOfSamplesInOneSec;
        mCurrentAvgEnergyOneSec[2] = mRunningSoundAvg[2]
                / mNumberOfSamplesInOneSec;
        mNumberOfSamplesInOneSec = 0;
        mRunningSoundAvg[0] = 0.0;
        mRunningSoundAvg[1] = 0.0;
        mRunningSoundAvg[2] = 0.0;
        mSystemTimeStartSec = System.currentTimeMillis();
    }
}

// USE INTERFACES IN NEXT UPDATE:
private void fireBeatDetectedLowEvent(double power) {
    // Utility.log("LOW BEAT DETECTED!");
    Game.lowBeat(power);
    if (onBeatDetectedListener != null) {
        onBeatDetectedListener.onBeatDetectedLow();
    }
}

private void fireBeatDetectedMidEvent(double power) {
    // Utility.log("MEDIUM BEAT DETECTED!");
    Game.mediumBeat(power);
    if (onBeatDetectedListener != null) {
        onBeatDetectedListener.onBeatDetectedMid();
    }
}

private void fireBeatDetectedHighEvent(double power) {
    // Utility.log("HIGH BEAT DETECTED!");
    Game.highBeat(power);
    if (onBeatDetectedListener != null) {
        onBeatDetectedListener.onBeatDetectedHigh();
    }
}

public void setOnBeatDetectedListener(OnBeatDetectedListener listener) {
    onBeatDetectedListener = listener;
}

public interface OnBeatDetectedListener {
    public abstract void onBeatDetectedLow();

    public abstract void onBeatDetectedMid();

    public abstract void onBeatDetectedHigh();
}
}
public static void highBeat(double power) {
    HIGH_FREQUENCY += (power * 1000); // ORIGINAL: * 1000
    if (HIGH_FREQUENCY > GameValues.FREQ_MAX) {
        HIGH_FREQUENCY = GameValues.FREQ_MAX;
    }
    updateHighFreq();
}

public static void updateHighFreq() {
    prcnt = HIGH_FREQUENCY * 100 / GameValues.FREQ_MAX;
    if (prcnt < 0)
        prcnt = 0;
    HIGH_F_HEIGHT = (int) (GameValues.FREQ_MAX_HEIGHT * (prcnt / 100));
}

Is there anything simple for debugger visualizers in C# that's analogous to editing autoexp.dat for C++?


Tag : chash , By : pjkinney
Date : March 29 2020, 07:55 AM
I hope this helps . Override ToString() for your objects, or use DebuggerDisplay (thanks @gdir).

Simple music visualizer


Tag : java , By : nonkelhans
Date : March 29 2020, 07:55 AM
Related Posts Related QUESTIONS :
  • Memory alignment rules in inheritance
  • Is nullptr falsy?
  • tm_wday returns a large integer outside 0-6 range
  • Scope a using declaration, inside a header
  • How to specify constructor's template arguments inside a new expression?
  • Sort an array via x86 Assembly (embedded in C++)?? Possible?
  • How to Replace only Part of the Variable using #define
  • How do you compare the performace of valarrays vs built-in arrays?
  • Is it normal for C++ static initialization to appear twice in the same backtrace?
  • c++ generate a good random seed for psudo random number generators
  • Why isn't my operator overloading working properly?
  • Getting meaningful error messages from fstream's in C++
  • C++: Converting Julian dates to Gregorian
  • Could someone explain this interesting behaviour with Sleep(1)?
  • Is it possible to roll a significantly faster version of modf
  • Updating pointer using signals and slots
  • How are classes more secure than structures?
  • finding "distance" between two pixel's colors
  • C++ Greatest Number Verification
  • Why does my token return NULL and how can I fix it?(c++)
  • C++ enforce conditions on inherited classes
  • what happened if an exception is not captured?
  • Redundant naming in C/C++ typedefs/structs
  • question about STL thread-safe and STL debugging
  • killing a separate thread having a socket
  • Returning the size of available virtual memory at run-time in C++
  • Parallel computing for integrals
  • How do I force my std::map to deallocate memory used?
  • C++ Templates: implicit conversion, no matching function for call to ctor
  • Adding python script to c++ project
  • C++ private pointer "leaking"?
  • Initializing Primitive Array to One Value
  • how is push_back implemented in STL vector?
  • C++ Profiling: KiFastSystemCallRet
  • Multiple rows with a single INSERT in SQLServer 2008
  • Use super class's address/pointer in initialization list
  • double fork using vfork
  • Convert char pointer (char*) to struct
  • Does anyone have good tips for using pc-lint?
  • C++ How fast is passing around objects?
  • template type's ctor arguments at instantiation time
  • Get list of windows in taskbar on Windows 7?
  • Curl connection options
  • Best cross-platform solution for network server?
  • simple c++ file opening issue
  • Switching from C++ (with a lot of STL use) to C for interpreter building
  • How can I access the JPEG image pixels as a 3D array like we do in MATLAB?
  • What wording in the C++ standard allows static_cast<non-void-type*>(malloc(N)); to work?
  • Avoid allocating in constructor or preserve simplicity (and RAII?)
  • Can C++ raise an error when std array initialization is too small?
  • Reference to end is ambiguous
  • Problem with basic usage of std::enable_if
  • How to print out a decimal number as octal number using setiosflags in C++
  • Open Visual Studio with solution and specific file and line
  • Enum value based on template type
  • Is there any way to swap nodes in std::list?
  • How to copy QString into wchar_t buffer
  • Make the compiler generate an empty default function for an std::function
  • Insert or push_back to end of a std::vector?
  • Best practice for const temporary types
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com