Download Audio_Effects_SDK/samples/utils/wave_reader/wave.hpp from zohann/nvidia_sdk: direct link, hf CLI and curl.
- Browser
- Download file 4.35 kB
-
https://huggingface.co/zohann/nvidia_sdk/resolve/main/Audio_Effects_SDK/samples/utils/wave_reader/wave.hpp
- Command line
-
hf download hf://zohann/nvidia_sdk/Audio_Effects_SDK/samples/utils/wave_reader/wave.hpp
-
curl -L -o wave.hpp https://huggingface.co/zohann/nvidia_sdk/resolve/main/Audio_Effects_SDK/samples/utils/wave_reader/wave.hpp
4.35 kB
| /* | |
| * Copyright (c) 2019, NVIDIA Corporation. All rights reserved. | |
| * | |
| * NVIDIA Corporation and its licensors retain all intellectual property | |
| * and proprietary rights in and to this software, related documentation | |
| * and any modifications thereto. Any use, reproduction, disclosure or | |
| * distribution of this software and related documentation without an express | |
| * license agreement from NVIDIA Corporation is strictly prohibited. | |
| */ | |
| typedef struct { | |
| int ckId; | |
| int cksize; | |
| int waveId; | |
| int waveChunks; | |
| } WaveHeader; | |
| typedef struct { | |
| uint16_t formatTag; /* format type */ | |
| uint16_t nChannels; /* number of channels (i.e. mono, stereo...) */ | |
| unsigned int nSamplesPerSec; /* sample rate */ | |
| unsigned int nAvgBytesPerSec; /* for buffer estimation */ | |
| uint16_t nBlockAlign; /* block size of data */ | |
| } waveFormat_basic_nopcm; | |
| typedef struct { | |
| uint16_t formatTag; /* format type */ | |
| uint16_t nChannels; /* number of channels (i.e. mono, stereo...) */ | |
| unsigned int nSamplesPerSec; /* sample rate */ | |
| unsigned int nAvgBytesPerSec; /* for buffer estimation */ | |
| uint16_t nBlockAlign; /* block size of data */ | |
| uint16_t wBitsPerSample; /* Number of bits per sample of mono data */ | |
| } waveFormat_basic; | |
| typedef struct { | |
| uint16_t wFormatTag; /* format type */ | |
| uint16_t nChannels; /* number of channels (i.e. mono, stereo...) */ | |
| unsigned int nSamplesPerSec; /* sample rate */ | |
| unsigned int nAvgBytesPerSec; /* for buffer estimation */ | |
| uint16_t nBlockAlign; /* block size of data */ | |
| uint16_t wBitsPerSample; /* Number of bits per sample of mono data */ | |
| uint16_t cbSize; /* the count in bytes of the size of */ | |
| /* extra information (after cbSize) */ | |
| } waveFormat_ext; | |
| class Wave { | |
| public: | |
| Wave(); | |
| explicit Wave(std::string filename); | |
| Wave(const Wave & argB); | |
| ~Wave(); | |
| /* Tools for creating waves in software */ | |
| Wave(unsigned int nSamples, unsigned int nChannels, unsigned int sampleRate, unsigned int bitDepth); | |
| // Special Constructor used for construction by extractChannel | |
| Wave(unsigned int nSamples, unsigned int sampleRate, unsigned int bitDepth, float * singleChannel); | |
| /* Tools for allowing waves to interact */ | |
| Wave & operator -=(const Wave & argB); | |
| Wave & operator *=(float scale); | |
| void operator >> (int shiftSamples); | |
| void operator >> (float shiftSeconds); | |
| void operator <<(int shiftSamples); | |
| void operator <<(float shiftSeconds); | |
| float& operator[](int sampleIndex); | |
| float* getDataPtr(int channelIndex, int sampleIndex); | |
| Wave extractChannel(int channelIndex); | |
| void setChannel(int channelIndex, Wave* argB); | |
| unsigned int getNumSamples(); | |
| unsigned int getNumChannels(); | |
| unsigned int getBitDepth(); | |
| unsigned int getSampleRate(); | |
| void writeFile(std::string filename); | |
| int maxInt(int channelId); | |
| int minInt(int channelId); | |
| float maxFloat(int channelId); | |
| float minFloat(int channelId); | |
| void append(int numChannels, int numAppendedSamples, float ** buffers); | |
| void normalize(); | |
| private: | |
| unsigned int m_numChannels; | |
| unsigned int m_sampleRate; | |
| unsigned int m_bitDepth; | |
| unsigned int m_numSamples; | |
| unsigned int m_bufferAllocation; | |
| int ** m_intData; | |
| float ** m_floatData; | |
| bool m_PCMIntValid; | |
| bool m_PCMFloatValid; | |
| bool allocateInt(); | |
| bool allocateFloat(); | |
| void reallocate(); | |
| void freeInt(); | |
| void freeFloat(); | |
| void fillFloatFromInt(); | |
| void fillIntFromFloat(); | |
| void validFloat(); | |
| void readFromFile(std::string filename); | |
| }; | |