Cześć
Piszę już trochę zrezygnowany. Nie mam pojęcia jak tu się dobrać do próbek odtwarzanego dźwięku. Posiadam kod, który faktycznie jest przykładem z jakiegoś tutoriala ale ogarniam co się w nim dzieje. W zasadzie ten kod mi wystarcza do tego co chcę zrobić a mianowicie odtworzyć dźwięk jakoś odpowiednio zmodulowany. Problem tylko w tym, że nie wiem jak dobrać się do próbek. Jeśli macie jakiś pomysł bardzo prosiłbym o jakąś podpowiedź.
#include <SDL.h>
#include <windows.h>
#include <SDL_mixer.h>
//#include <SDL_thread.h>
#include <iostream>
int main( int argc, char * args[] )
{
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) != 0) {
fprintf(stderr, "Unable to initialize SDL: %s\n", SDL_GetError());
return 1;
}
int audio_rate =22050;
Uint16 audio_format = AUDIO_S16SYS;
int audio_channels = 2;
int audio_buffers = 4096;
if(Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers) != 0) {
fprintf(stderr, "Unable to initialize audio: %s\n", Mix_GetError());
exit(1);
}
Mix_Chunk *sound = NULL;
sound = Mix_LoadWAV("D:/Program files/TeamSpeak 3 Client/sound/default_male/your_channel_was_edited.wav");
if(sound == NULL) {
fprintf(stderr, "Unable to load WAV file: %s\n", Mix_GetError());
}
SDL_Surface *screen;
screen = SDL_SetVideoMode(320, 240, 0, SDL_ANYFORMAT);
if (screen == NULL) {
fprintf(stderr, "Unable to set video mode: %s\n", SDL_GetError());
return 1;
}
int channel;
channel = Mix_PlayChannel(-1, sound, 0);
if(channel == -1) {
fprintf(stderr, "Unable to play WAV file: %s\n", Mix_GetError());
}
while(Mix_Playing(channel) != 0);
Mix_FreeChunk(sound);
Mix_CloseAudio();
SDL_Quit();
return 0;
}