2 * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
4 * This program is licensed under the terms and conditions of the
5 * Apache License, version 2.0. The full text of the Apache License is at
6 * http://www.apache.org/licenses/LICENSE-2.0
10 * @brief Sound Sample APP
11 * Test use with which sound is sounded
16 #ifndef YSWAVFILE_IS_INCLUDED
17 #define YSWAVFILE_IS_INCLUDED
20 #ifndef YSRESULT_IS_DEFINED
21 #define YSRESULT_IS_DEFINED
22 /*! Enum for processing result. */
25 YSERR, /*!< There were error(s). */
26 YSOK /*!< The process was successful. */
30 #ifndef YSBOOL_IS_DEFINED
31 #define YSBOOL_IS_DEFINED
32 /*! Enum for boolearn. */
35 YSFALSE, /*!< False */
37 YSTFUNKNOWN /*!< Unable to tell true or false. */
47 unsigned int sizeInBytes;
56 void Initialize(void);
58 unsigned int NTimeStep(void) const;
60 YSBOOL Stereo(void) const;
61 unsigned int BytePerTimeStep(void) const;
62 unsigned int BitPerSample(void) const;
63 unsigned int BytePerSample(void) const;
64 unsigned int PlayBackRate(void) const;
65 unsigned int SizeInByte(void) const;
66 YSBOOL IsSigned(void) const;
67 const unsigned char *DataPointer(void) const;
68 const unsigned char *DataPointerAtTimeStep(unsigned int ts) const;
70 YSRESULT LoadWav(const char fn[]);
71 YSRESULT ConvertTo16Bit(void);
72 YSRESULT ConvertTo8Bit(void);
73 YSRESULT ConvertToStereo(void);
74 YSRESULT ConvertToMono(void);
75 // YSRESULT Resample(int newRate);
76 YSRESULT Resample(unsigned int newRate);
78 YSRESULT ConvertToSigned(void);
79 YSRESULT ConvertToUnsigned(void);
82 int GetNumChannel(void) const;
83 int GetNumSample(void) const;
84 int GetNumSamplePerChannel(void) const;
85 size_t GetUnitSize(void) const;
86 size_t GetSamplePosition(int atIndex) const;
87 int GetSignedValue(int atTimeStep, int channel) const;
88 void SetSignedValue(unsigned char *savePtr, int rawSignedValue);