~registry/dolphin-emu/triforce

« back to all changes in this revision

Viewing changes to Source/Core/AudioCommon/Src/WaveFile.h

  • Committer: Sérgio Benjamim
  • Date: 2015-02-13 05:54:40 UTC
  • Revision ID: sergio_br2@yahoo.com.br-20150213055440-ey2rt3sjpy27km78
Dolphin Triforce branch from code.google, commit b957980 (4.0-315).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright 2013 Dolphin Emulator Project
 
2
// Licensed under GPLv2
 
3
// Refer to the license.txt file included.
 
4
 
 
5
// ---------------------------------------------------------------------------------
 
6
// Class: WaveFileWriter
 
7
// Description: Simple utility class to make it easy to write long 16-bit stereo
 
8
// audio streams to disk.
 
9
// Use Start() to start recording to a file, and AddStereoSamples to add wave data.
 
10
// The float variant will convert from -1.0-1.0 range and clamp.
 
11
// Alternatively, AddSamplesBE for big endian wave data.
 
12
// If Stop is not called when it destructs, the destructor will call Stop().
 
13
// ---------------------------------------------------------------------------------
 
14
 
 
15
#ifndef _WAVEFILE_H_
 
16
#define _WAVEFILE_H_
 
17
 
 
18
#include "FileUtil.h"
 
19
 
 
20
class WaveFileWriter
 
21
{
 
22
        File::IOFile file;
 
23
        bool skip_silence;
 
24
        u32 audio_size;
 
25
        short *conv_buffer;
 
26
        void Write(u32 value);
 
27
        void Write4(const char *ptr);
 
28
 
 
29
        WaveFileWriter& operator=(const WaveFileWriter&)/* = delete*/;
 
30
 
 
31
public:
 
32
        WaveFileWriter();
 
33
        ~WaveFileWriter();
 
34
 
 
35
        bool Start(const char *filename, unsigned int HLESampleRate);
 
36
        void Stop();
 
37
 
 
38
        void SetSkipSilence(bool skip) { skip_silence = skip; }
 
39
 
 
40
        void AddStereoSamples(const short *sample_data, u32 count);
 
41
        void AddStereoSamplesBE(const short *sample_data, u32 count);  // big endian
 
42
        u32 GetAudioSize() { return audio_size; }
 
43
};
 
44
 
 
45
#endif  // _WAVEFILE_H_