I haven't played with images since the 90's. So, I imagine a lot has changed. I want to edit an image and make it circular, not rectangular. How can I do this in Image Editor? My application is going to make this image rotate. Thank you. Bill Dennis Orlando, FL
billiam904
Posts
-
Image Editor/Circular Images -
Setting record mixer properties inside appI need to be able to automatically adjust recording mixer properties from inside my app such as making sure that "Line In" is selected versus Microphone or other device, set record volume to 50% and make sure left/right balance is set to 50%. I have looked at the mixer functions but n ot sure how to proceed. Can someone give me some sample code please? Thank you very much. Bill Dennis Orlando, FL
-
Accessing/Assigning data buffer from pointerThank you. I got it working and you cleared some things up. Bill Dennis Orlando, FL
-
Accessing/Assigning data buffer from pointerI am converting a wave file for which my boss gave me the calculations for. I have two PUCHAR buffers alloocated with GLOBALALLOC. One is input buffer which I have loaded from the file, the other is an output buffer which I will store the converted data into. The buffers are defined as follows: PUCHAR m_pbyDemoBuffer; PWORD m_pwOutDemoAudio; I need to convert m_pbyDemoBuffer to 16-bit (PWORD), then perform calculation on it before storing it in m_pwOutDemoAudio. I need to do this by indexing each 16-bit element. My question is, how do I convert the input buffer to PWORD and how would I assign the value (plus whatever calculations I make) of index 0 of m_pbyDemoBuffer to the value of index 0 of m_pwDemoOutAudio? My boss is having me do the following: m_pwDemoOutAudio[0] = m_pbyDemoInBuffer[0] * 128 I think this is wrong because both variables are pointers. Wouldn't the above code assign the "memory address times 128" to m_pwDemoOutAudio? Thanks. Bill Dennis Orlando, FL
-
Class not visibleNo, no namespaces. Boss doesn;t want to use namespaces. Getting undefined class error when compiling on the line where I am insantiating a new class variable: Class2 cClass2; Bill Dennis Orlando, FL
-
Class not visibleI am a newbie to vc++. I did some C 15 years ago... but, normally, I'm a vb.net guy. However, my current job is VC++ and my boss wants me to place a class inside a .h and .cpp file that already has an existing class. I did this fine but when trying to define an instance of this class from another class, it seems invisible even though I have included the .h file. Here's my code: file1.h class Class1 { // definitions here }; class Class2 { // definitions here }; File1.cpp: #include "file1.h" Class1::SomeFunction() { } Class2::AnotherFunction() { } File 2.h #include "File1.h" class Class3 { Class2 cClass2; // not visible. }; Any ideas? Bill Dennis Orlando, FL
-
global buffer or passing by reference?.h: #include #include #include #define ERROR_LENGTH 1024 class CReadDemoWave { public: BYTE m_pbyDemoBuffer; static int testinteger; void ReadDemoWave(); BYTE *ReadDemoIntoBuffer(); void PlayWav(); long QueueWaveData(HWAVEOUT HWaveOut, WAVEHDR * waveHeader, DWORD WaveDataPlayed, DWORD WaveBufSize, HMMIO HMmio); BYTE *GetDemoBuffer(void); //void WriteDemo(HMMIO recordHandle); //public: // =========== D == E == M == O ======================= // BD create demo buffer. WAVEHDR lpDemoData; DWORD dwDemoDataSize; int m_nDemoBufferSize; //BYTE* m_pbyDemoBuffer; HMMIO m_hmmio; //HMMIO hmmio; char m_szError[ERROR_LENGTH]; int m_nError; MMIOINFO m_mmioInfo; DWORD dwDataSize; DWORD dwCount; HPSTR m_hptr; int m_nBufferSize; //WAVEFORMATEX waveFormat; }; .cpp: // ================DEMO======================== BYTE *ReadDemoWave::ReadDemoIntoBuffer() { // HPSTR demobuffer; // Open file if( (m_hmmio=mmioOpen("AIPL.WAV", NULL,MMIO_ALLOCBUF | MMIO_READ )) == NULL ) { AfxMessageBox("A critical file is missing from your system. Contact AIPL. Singulator will now stop."); m_nError = 1; exit(NULL); } // GET INFO ON FILE I/O BUFFER if (mmioGetInfo(m_hmmio, &m_mmioDemoInfo, 0)) { sprintf(m_szError, "Failed to get I/O buffer info/n"); AfxMessageBox("Failed to get I/O buffer info"); m_nError = 1; mmioClose(m_hmmio,0); return (NULL); } // check if needs advance if (m_mmioDemoInfo.pchNext == m_mmioDemoInfo.pchEndRead){ if (mmioAdvance(m_hmmio,&m_mmioDemoInfo, MMIO_READ)){ //ERROR HERE mmioClose(m_hmmio, 0); sprintf(m_szError, "Failed to Advance I/O buffer info/n"); AfxMessageBox("Failed to advance I/O buffer info"); m_nError = 1; return (NULL); } } HWND hwnd=NULL; LPSTR path = "AIPL.WAV"; PlayWav(); WriteDemo(&m_pbyDemoBuffer,dwDemoDataSize); mmioSetInfo(m_hmmio, &m_mmioDemoInfo, 0); mmioClose(m_hmmio, 0); return (&m_pbyDemoBuffer); } //================PLAYWAV======================= void CReadDemoWave::PlayWav() { HMMIO hmmio; MMCKINFO mmckinfoParent; MMCKINFO mmckinfoSubchunk; DWORD dwFmtSize; DWORD WaveDataPlayed; HWAVEOUT hwaveout=NULL; WAVEFORMATEX waveFormat; /* for reading a fmt chunk's data */ waveFormat.wFormatTag = WAVE_FORMAT_PCM; if((hmmio=mmioOpen("aipl.WAV",NULL,MMIO_READ | MMIO_ALLOCBUF)) == NULL) { AfxMessageBox("Error opening file")
-
global buffer or passing by reference?I've pasted part of the code below. I have a lot of junk commented out in the actual .cpp file but if you want that, I can send it without violating my contract. Thanks. ''Allocate space for data in lpDemoData structure. // lpData is LPSTR. if (!( lpDemoData.lpData = (char *)VirtualAlloc(0, dwDemoDataSize<<1, MEM_COMMIT, PAGE_READWRITE))) { printf("ERROR: Can't allocate memory for WAVE buffer!\n"); } // Read Data Chunk into lpData if (readres = mmioRead(hmmio, (HPSTR )lpDemoData.lpData, dwDemoDataSize) != dwDemoDataSize) { AfxMessageBox("Error: Failed to read data chunk."); mmioClose(hmmio,0); return; } //Create byte-based buffer, allocate memory and copy // lpData to it. int lenlpData=strlen(lpDemoData.lpData); m_pbyDemoBuffer=(BYTE)GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, lenlpData ); memcpy((BYTE*)m_pbyDemoBuffer, lpDemoData.lpData, lenlpData); Bill Dennis Orlando, FL
-
global buffer or passing by reference?In another post, I asked someone to show me how to allocate member for m_pbyDemoBuffer. I am rewading the wave data into a LPSTR variable, then creating and allocating memory for m_pbyDemoBuffer using GlobalAlloc and doing memcpy from lpDemoData.lpData to m_pbyDemoBuffer. I am then returning *m_pbyDemoBuffer in GetDemoBuffer(). So, not using arrays here. Bill Dennis Orlando, FL
-
global buffer or passing by reference?I have it like this: BYTE *CReadDemoWave::GetDemoBuffer(void) { return &m_pbyDemoBuffer; } When I take out the refrence (&), I get a compiler error saying it can't convert from BYTE to BYTE*. It's been 15 years since I've worked with pointers so not sure I am doing this correctly. My pointer seems to be resetting itself from the time the buffer is created and the time I call GetDemoBuffer(). Bill Dennis Orlando, FL
-
global buffer or passing by reference?Thanks. Can you give me an idea of the implementation code for the getBuffer function to make sure I'm doing it right. I wrote one but it kepts resetting. Here's my read .h #include #include #include #define ERROR_LENGTH 1024 class CReadDemoWave { public: BYTE m_pbyDemoBuffer; static int testinteger; void ReadDemoWave(); BYTE *ReadDemoIntoBuffer(); void PlayWav(); long QueueWaveData(HWAVEOUT HWaveOut, WAVEHDR * waveHeader, DWORD WaveDataPlayed, DWORD WaveBufSize, HMMIO HMmio); BYTE *GetDemoBuffer(void); //void WriteDemo(HMMIO recordHandle); //public: // =========== D == E == M == O ======================= // BD create demo buffer. WAVEHDR lpDemoData; DWORD dwDemoDataSize; int m_nDemoBufferSize; //BYTE* m_pbyDemoBuffer; HMMIO m_hmmio; //HMMIO hmmio; char m_szError[ERROR_LENGTH]; int m_nError; MMIOINFO m_mmioInfo; DWORD dwDataSize; DWORD dwCount; HPSTR m_hptr; int m_nBufferSize; //WAVEFORMATEX waveFormat; }; Bill Dennis Orlando, FL
-
global buffer or passing by reference?////////////////////////////////////////////////////////////////////// // WavWrite.h: interface for the CWavWrite class. #if !defined(AFX_WAVWRITE_H__2C400A28_DDC3_11D0_9FD3_444553540001__INCLUDED_) #define AFX_WAVWRITE_H__2C400A28_DDC3_11D0_9FD3_444553540001__INCLUDED_ #if _MSC_VER >= 1000 #pragma once #endif // _MSC_VER >= 1000 #include #include #include //#include "readdemowave.h" #define ERROR_LENGTH 1024 //CReadDemoWave cReadDemo; //static DWORD dwDemoDataSize; //WAVEHDR lpDemoData; //static WAVEHDR lpDemoData; /* Definition from MS typedef struct { WORD wFormatTag; WORD nChannels; DWORD nSamplesPerSec; DWORD nAvgBytesPerSec; WORD nBlockAlign; WORD wBitsPerSample; WORD cbSize; } WAVEFORMATEX; typedef struct { FOURCC ckid; DWORD cksize; FOURCC fccType; DWORD dwDataOffset; DWORD dwFlags; } MMCKINFO; */ class CWavWrite { private: char m_szName[FILENAME_MAX]; HMMIO m_hmmioFile; HMMIO m_hmmioDemoFile; MMCKINFO m_ckRIFF, m_ckfmt, m_ckdata; int m_nDataLeft; WAVEFORMATEX *m_pwfx; PCMWAVEFORMAT m_pcmWaveFormat; int m_cbExtraAlloc; MMIOINFO m_mmioInfo; // BD 9/13/05 /*int DEMO; int rndcnt; int bufcnt;*/ // Created here so not created each time Read or Write Data is called // Otherwise these could be local variables - trade speed for size int m_nCopyLength, m_nActualWrite; int m_i; // Error variables int m_nError; char m_szError[ERROR_LENGTH]; public: //WAVEHDR lpDemoData; //DWORD dwDemoDataSize; // Constructor (empty) / Destructor CWavWrite(); virtual ~CWavWrite(); // Data processing - too large to be effective as an inline functions // BD added lat param for demo buffer //int Write(BYTE *pBuffer, int nDataSize, WAVEHDR *pDemoBuffer); int Write(BYTE *pBuffer, int nDataSize); void WriteDemo(BYTE *pBuffer, int nDataSize); // File Manipulation void Open(void); void Init(MMCKINFO *pckRIFF, MMCKINFO *pckfmt, MMCKINFO *pckdata, WAVEFORMATEX *pwfx, int nBufferSize); void Init(short wBitsPerSample, int nSampleFrequency, short wChannels, int nBufferSize); void Close(void); // Parameter Manipulation void SetName(char *); char *GetName(void); // Parameters below may be different than input file, CWavRead. long GetNumberOfSamples(void); long GetSampleFrequency(void); short GetBitsPerSample(void); short GetNumberOfCha
-
Converting LPSTR to BYTE *?I have a WAVEHDR structure set up and I want to store the data from the lpData element which is of type LPSTR to BYTE * for allocating a memory block using GlobalAlloc and to pass back the pointer of this new memory block. Does anyone know how I can convert LPSTR to BYTE* to do this or can someone show me how to dump the data from the lpData element of a WAVEHDR structure to a BYTE-based memory buffer? Thanks. Bill Dennis Orlando, FL
-
global buffer or passing by reference?I'm sorry but now I get the following message: Single error LNK2001: unresolved external symbol "public: static int CReadDemoWave::testinteger" (?testinteger@CReadDemoWave@@2HA) Here is my .h: #include #include #include #define ERROR_LENGTH 1024 class CReadDemoWave { public: static int testinteger; void ReadDemoWave(); void ReadDemoIntoBuffer(); void PlayWav(); long QueueWaveData(HWAVEOUT HWaveOut, WAVEHDR * waveHeader, DWORD WaveDataPlayed, DWORD WaveBufSize, HMMIO HMmio); LPSTR *GetDemoBuffer(void); void WriteDemo(HMMIO recordHandle); // =========== D == E == M == O ======================= // BD create demo buffer. WAVEHDR lpDemoData; DWORD dwDemoDataSize; int m_nDemoBufferSize; BYTE* m_pbyDemoBuffer; HMMIO m_hmmio; //HMMIO hmmio; char m_szError[ERROR_LENGTH]; int m_nError; MMIOINFO m_mmioInfo; DWORD dwDataSize; DWORD dwCount; HPSTR m_hptr; int m_nBufferSize; }; Bill Dennis Orlando, FL
-
global buffer or passing by reference?This would be good if it were a new system or code already written in this fashion but I am modifying someone else's code, so I can';t totally rewrite the program. But, thanks. Bill Dennis Orlando, FL
-
global buffer or passing by reference?I did as you suggested and am etting the following error: c:\development\c-tools\Classes\WavWrite.cpp(79): error C2248: 'CReadDemoWave::testinteger' : cannot access private member declared in class 'CReadDemoWave' I need to be able to access this data from three separate .cpp files. Here's my 'h: \ class CReadDemoWave { static int testinteger; public: void ReadDemoWave(); void ReadDemoIntoBuffer(); void PlayWav(); long QueueWaveData(HWAVEOUT HWaveOut, WAVEHDR * waveHeader, DWORD WaveDataPlayed, DWORD WaveBufSize, HMMIO HMmio); LPSTR *GetDemoBuffer(void); void WriteDemo(HMMIO recordHandle); WAVEHDR lpDemoData; DWORD dwDemoDataSize; int m_nDemoBufferSize; BYTE* m_pbyDemoBuffer; HMMIO m_hmmio; }; I am including the .h in all three .cpp files. Am I doing something wrong? Bill Dennis Orlando, FL
-
read buffer problemThere is an article in the audio section on building and dusplaying "peak files". A peak file is the bit representation of your waveform. The same code shows to display it. Bill Dennis Orlando, FL
-
record VoiceHi, this is exactly what I am doing now. I am using the MCI commands, WaveInOpen(), mmioWrite(), etc. There are some good articles here that helped me. But, I had to take a combination of the articles to actually get my project to work. Check out MCI at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/\_win32\_mci.asp Bill Dennis Orlando, FL
-
global buffer or passing by reference?First, I am new to C++. I have some C background with DOS and Unix but that was 15 years ago. My most recent work was vb.net. I am now doing some audio based coding in VC++ and I am having some problems, probably from my lack of knowledge. Unfortunately, I have until Monday to get this code working... I have three classes and three separate files. The developer that started this is simply calling the classes without reinstantiating them. I am reading a wave file in and that works fine. But, I need to create a global buffer for the wave data so that the other two classes can access it or find someway to pass the buffer by references to the other classes' functions. Can anyone give me some same code on doing this? Thank you. Bill Dennis Orlando, FL
-
sndvol32?what would i use to set the Line In record level? Bill Dennis Orlando, FL