Click here to Skip to main content
15,907,392 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Translation (.rc) String tables Pin
CPallini2-Feb-09 9:00
mveCPallini2-Feb-09 9:00 
Questionfloating point error in C++ Pin
Vivek Narayanan2-Feb-09 5:45
Vivek Narayanan2-Feb-09 5:45 
AnswerRe: floating point error in C++ Pin
David Crow2-Feb-09 5:51
David Crow2-Feb-09 5:51 
GeneralRe: floating point error in C++ Pin
Vivek Narayanan2-Feb-09 6:30
Vivek Narayanan2-Feb-09 6:30 
QuestionRe: floating point error in C++ Pin
David Crow2-Feb-09 7:21
David Crow2-Feb-09 7:21 
AnswerRe: floating point error in C++ Pin
Vivek Narayanan3-Feb-09 3:54
Vivek Narayanan3-Feb-09 3:54 
AnswerRe: floating point error in C++ Pin
Koolski2-Feb-09 9:56
Koolski2-Feb-09 9:56 
Questionencode wave to ogg [modified] Pin
Daerner Mandla2-Feb-09 5:08
Daerner Mandla2-Feb-09 5:08 
Hello,
i would encode a wavebuffer to the ogg speex.

My actually code is like this:
HWAVEIN hWaveIn;
WAVEHDR WaveHdrIn[AUDIOBUFS];
BYTE BufferIn[AUDIOBUFS][BUFSIZE];

DWORD WINAPI WaveInThread (void *Arg)
{
  MSG Msg;
  int rv;

  rv = SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_TIME_CRITICAL);
  winexit_if(0 == rv, hWindow, "SetThreadPriority failed");

  while (GetMessage (&Msg, NULL, 0, 0) == TRUE) {
    if (MM_WIM_DATA == Msg.message) {
      int rv = 0;
      WAVEHDR *Hdr = (WAVEHDR *) Msg.lParam;

      EnterCriticalSection(&remotefd_sem);
      if (remotefd != INVALID_SOCKET) {
        rv = sendto(remotefd, Hdr->lpData, sizeof(BufferIn[0]), 0, 
                             (struct sockaddr *) &remote, sizeof(remote));
        if (rv < 0) {
          closesocket(remotefd);
          remotefd = INVALID_SOCKET;
        }
      }
      LeaveCriticalSection(&remotefd_sem);
      waveInAddBuffer(hWaveIn, Hdr, sizeof(*Hdr));
      if (rv < 0) MessageBox(hWindow, "sendto failed", "WARNING", MB_OK);
    }
  }
  return 0; 
}

BOOL CALLBACK DlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) 
{
  switch (msg) {
    case WM_INITDIALOG: {      
      WSADATA wsaData;
      int rv;
      int i;
      WAVEFORMATEX waveform;
      HANDLE WaveInThreadHandle;
      DWORD WaveInThreadId;
      
      hWindow = hWnd;

      // Init Netzwerk
      rv = WSAStartup(MAKEWORD(2, 2), &wsaData);
      winexit_if(rv != 0, hWnd, "WSAStartup failed");

      // Init Audio
      waveform.nChannels = AUDIOCHANNELS;
      waveform.wBitsPerSample = 8;
      waveform.nAvgBytesPerSec = AUDIOSPEED * waveform.nChannels * waveform.wBitsPerSample / 8;
      waveform.wFormatTag = AUDIOFORMAT;
      waveform.nSamplesPerSec = AUDIOSPEED;
      waveform.nBlockAlign = 1;
      waveform.cbSize = 0;

      WaveInThreadHandle = CreateThread(NULL, 0, WaveInThread, NULL, 0, &WaveInThreadId);
      winexit_if(NULL == WaveInThreadHandle, hWnd, "CreateThread failed");

      rv = waveInOpen(&hWaveIn, WAVE_MAPPER, &waveform, (DWORD)WaveInThreadId,0,CALLBACK_THREAD);
      winexit_if(rv != MMSYSERR_NOERROR, hWnd, "waveInOpen failed f");

      for (i = 0; i < AUDIOBUFS; ++i) {
        WaveHdrIn[i].lpData = BufferIn[i];
        WaveHdrIn[i].dwBufferLength = sizeof(BufferIn[0]);
        WaveHdrIn[i].dwBytesRecorded = 0;
        WaveHdrIn[i].dwUser = 0;
        WaveHdrIn[i].dwFlags = 0;
        WaveHdrIn[i].dwLoops = 0;
        WaveHdrIn[i].lpNext = NULL;
        WaveHdrIn[i].reserved = 0;
        waveInPrepareHeader(hWaveIn, WaveHdrIn + i, sizeof(WaveHdrIn[0]));
        waveInAddBuffer(hWaveIn, WaveHdrIn + i, sizeof(WaveHdrIn[0]));
      }

      waveInStart(hWaveIn);   // starte Aufnahme
      break;
    }


How can i encode the firstly wave?
I would handle with the microphon stream as wave. Only one step befor i send it with a socket i would encode it to ogg.
I finde the Page of the Ogg speex Project, but i cant understand the message behind the libary and the project has not a board for questions.
http://www.speex.org/docs/api/speex-api-reference.pdf


PS. Sorry for my bad english.

modified on Monday, February 2, 2009 12:04 PM

QuestionConverting Microsoft Visual C/C++ version 2.0 solution to Visual C++ 2005/2008 Pin
Cosmin Ciuraru2-Feb-09 3:56
Cosmin Ciuraru2-Feb-09 3:56 
AnswerRe: Converting Microsoft Visual C/C++ version 2.0 solution to Visual C++ 2005/2008 Pin
Iain Clarke, Warrior Programmer2-Feb-09 4:52
Iain Clarke, Warrior Programmer2-Feb-09 4:52 
QuestionError: Debug assertion failed! Pin
sam_psycho2-Feb-09 3:38
sam_psycho2-Feb-09 3:38 
AnswerRe: Error: Debug assertion failed! Pin
Code-o-mat2-Feb-09 3:41
Code-o-mat2-Feb-09 3:41 
GeneralRe: Error: Debug assertion failed! Pin
sam_psycho2-Feb-09 3:47
sam_psycho2-Feb-09 3:47 
GeneralRe: Error: Debug assertion failed! Pin
Code-o-mat2-Feb-09 4:03
Code-o-mat2-Feb-09 4:03 
AnswerRe: Error: Debug assertion failed! Pin
Iain Clarke, Warrior Programmer2-Feb-09 4:26
Iain Clarke, Warrior Programmer2-Feb-09 4:26 
AnswerRe: Error: Debug assertion failed! Pin
David Crow2-Feb-09 5:44
David Crow2-Feb-09 5:44 
Questionstatic Picture control not loading a bmp Pin
VC++Maniac2-Feb-09 1:36
VC++Maniac2-Feb-09 1:36 
AnswerRe: static Picture control not loading a bmp Pin
Hamid_RT2-Feb-09 3:19
Hamid_RT2-Feb-09 3:19 
GeneralRe: static Picture control not loading a bmp Pin
VC++Maniac2-Feb-09 3:20
VC++Maniac2-Feb-09 3:20 
AnswerRe: static Picture control not loading a bmp Pin
Code-o-mat2-Feb-09 3:39
Code-o-mat2-Feb-09 3:39 
GeneralRe: static Picture control not loading a bmp Pin
VC++Maniac2-Feb-09 3:44
VC++Maniac2-Feb-09 3:44 
GeneralRe: static Picture control not loading a bmp Pin
VC++Maniac2-Feb-09 4:12
VC++Maniac2-Feb-09 4:12 
Questioncopying line Pin
mac_g2-Feb-09 0:52
mac_g2-Feb-09 0:52 
AnswerRe: copying line Pin
CPallini2-Feb-09 1:08
mveCPallini2-Feb-09 1:08 
GeneralRe: copying line Pin
mac_g2-Feb-09 1:10
mac_g2-Feb-09 1:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.