41 #include "EST_cutils.h"
43 #include "EST_Option.h"
45 #include "EST_Pathname.h"
47 #ifdef SUPPORT_WIN32AUDIO
49 #include <EST_system.h>
66 WINBOOL STDCALL PlaySoundA(LPCSTR pszSound, HMODULE hmod, DWORD fdwSound);
69 #define PlaySound PlaySoundA
72 int win32audio_supported = TRUE;
85 short bits_per_sample;
92 char *buffer =
new char[
sizeof(riff_header) + inwave.
length()*inwave.
num_channels() *
sizeof(short)];
94 struct riff_header *hdr = (
struct riff_header *)buffer;
95 char *data = buffer +
sizeof(
struct riff_header);
97 strncpy(hdr->riff,
"RIFF", 4);
98 hdr->file_size =
sizeof(riff_header) + inwave.
length()*
sizeof(short);
99 strncpy(hdr->wave,
"WAVE", 4);
100 strncpy(hdr->fmt,
"fmt ", 4);
101 hdr->header_size = 16;
102 hdr->sample_format = WAVE_FORMAT_PCM;
105 hdr->bytes_per_second = hdr->sample_rate * hdr->n_channels * 2;
106 hdr->block_align = hdr->n_channels * 2;
107 hdr->bits_per_sample = 16;
108 strncpy(hdr->data,
"data", 4);
109 hdr->data_size = hdr->n_channels * 2 * inwave.
num_samples();
111 memcpy(data, inwave.values().
memory(), hdr->n_channels * 2 * inwave.
num_samples());
120 int win32audio_supported = FALSE;
126 cerr <<
"Windows win32 audio not supported" << endl;
A class for storing digital waveforms. The waveform is stored as an array of 16 bit shorts...
int length() const
return the size of the waveform, i.e. the number of samples.
Utility IO Function header file.
int num_channels() const
return the number of channels in the waveform
int num_samples() const
return the number of samples in the waveform
int sample_rate() const
return the sampling rate (frequency)