当前位置: 首页>>代码示例>>C++>>正文


C++ BASS_Free函数代码示例

本文整理汇总了C++中BASS_Free函数的典型用法代码示例。如果您正苦于以下问题:C++ BASS_Free函数的具体用法?C++ BASS_Free怎么用?C++ BASS_Free使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了BASS_Free函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SpectrumWindowProc

// window procedure
LRESULT CALLBACK SpectrumWindowProc(HWND h, UINT m, WPARAM w, LPARAM l)
{
	switch (m) {
		case WM_LBUTTONDOWN:
		case WM_RBUTTONDOWN:
		case WM_MOUSEMOVE:
			if (w&MK_LBUTTON) SetLoopStart(LOWORD(l)*bpp); // set loop start
			if (w&MK_RBUTTON) SetLoopEnd(LOWORD(l)*bpp); // set loop end
			return 0;

		case WM_MBUTTONDOWN:
			BASS_ChannelSetPosition(chan,LOWORD(l)*bpp,BASS_POS_BYTE); // set current pos
			return 0;

		case WM_TIMER:
			InvalidateRect(h,0,0); // refresh window
			return 0;

		case WM_PAINT:
			if (GetUpdateRect(h,0,0)) {
				PAINTSTRUCT p;
				HDC dc;
				if (!(dc=BeginPaint(h,&p))) return 0;
				BitBlt(dc,0,0,WIDTH,HEIGHT,wavedc,0,0,SRCCOPY); // draw peak waveform
				DrawTimeLine(dc,loop[0],0xffff00,12); // loop start
				DrawTimeLine(dc,loop[1],0x00ffff,24); // loop end
				DrawTimeLine(dc,BASS_ChannelGetPosition(chan,BASS_POS_BYTE),0xffffff,0); // current pos
				EndPaint(h,&p);
			}
			return 0;

		case WM_CREATE:
			win=h;
			// initialize output
			if (!BASS_Init(-1,44100,0,win,NULL)) {
				Error("Can't initialize device");
				return -1;
			}
			if (!PlayFile()) { // start a file playing
				BASS_Free();
				return -1;
			}
			SetTimer(h,0,100,0); // set update timer (10hz)
			break;

		case WM_DESTROY:
			KillTimer(h,0);
			if (scanthread) { // still scanning
				killscan=TRUE;
				WaitForSingleObject((HANDLE)scanthread,1000); // wait for the thread
			}
			BASS_Free();
			if (wavedc) DeleteDC(wavedc);
			if (wavebmp) DeleteObject(wavebmp);
			PostQuitMessage(0);
			break;
	}
	return DefWindowProc(h, m, w, l);
}
开发者ID:Emulai,项目名称:ICT397-Project,代码行数:60,代码来源:custloop.c

示例2: BASS_StreamFree

void TForm1::StartRecording()
{
	run=1;
    WAVEFORMATEX *wf;
    if (recbuf) { // free old recording
        BASS_StreamFree(chan);
        chan=0;
        free(recbuf);
        recbuf=NULL;
        // close output device before recording incase of half-duplex device
        BASS_Free();
    }
    // allocate initial buffer and make space for WAVE header
    recbuf=(char *)malloc(BUFSTEP);
    reclen=44;
    // fill the WAVE header
    memcpy(recbuf,"RIFF\0\0\0\0WAVEfmt \20\0\0\0",20);
    memcpy(recbuf+36,"data\0\0\0\0",8);
    wf=(WAVEFORMATEX*)(recbuf+20);
    wf->wFormatTag=1;
    wf->nChannels=CHANS;
    wf->wBitsPerSample=16;
    wf->nSamplesPerSec=FREQ;
    wf->nBlockAlign=wf->nChannels*wf->wBitsPerSample/8;
    wf->nAvgBytesPerSec=wf->nSamplesPerSec*wf->nBlockAlign;
    // start recording
	rchan=BASS_RecordStart(FREQ,CHANS,0,RecordingCallback,0);
    if (!rchan) {
        //Error("Couldn't start recording");
		free(recbuf);
		recbuf=0;
        return;
    }
    //MESS(10,WM_SETTEXT,0,"Stop");
}
开发者ID:whoisjohngalt,项目名称:MicrophoneSpectrum,代码行数:35,代码来源:Unit1.cpp

示例3: WndProc

LRESULT CALLBACK WndProc (HWND hWnd, UINT message,
                          WPARAM wParam, LPARAM lParam)
{
    switch (message)
    {
    case WM_CREATE:
        return 0;
    case WM_CLOSE:
    PostQuitMessage (0);
    // wind the frequency down...
	BASS_ChannelSlideAttribute(chan,BASS_ATTRIB_FREQ,1000,500);
	Sleep(300);
	// ...and fade-out to avoid a "click"
	BASS_ChannelSlideAttribute(chan,BASS_ATTRIB_VOL,-1,200);
	while (BASS_ChannelIsSliding(chan,0)) Sleep(1);
	BASS_Free();
	FreeBASS();
    return 0;
    case WM_DESTROY:
        return 0;

    default:
        return DefWindowProc (hWnd, message, wParam, lParam);
    }
}
开发者ID:AdrianG130,项目名称:glidehqplusglitch64,代码行数:25,代码来源:glTest.cpp

示例4: QDEBUG

/**
 * @brief No incoming parameters. Get data from RCHAN. Creating the stream file. If BASS_StreamCreateFile is failure colled BASS_Free().
 * @param No params
 */
void Widget::stopRecording()
{
    if (BASS_ChannelGetData(rchan, this->fft, BASS_DATA_FFT1024 | BASS_DATA_FFT_COMPLEX) == -1) {
        QDEBUG("Cannot get recbuf from rchan");
        QDEBUG(BASS_ErrorGetCode());
    }

    BASS_ChannelStop(rchan);
    rchan=0;
    ui->pushButton->setText(tr("Record"));
    // complete the WAVE header
    *(DWORD*)(recbuf+4)=reclen-8;
    *(DWORD*)(recbuf+40)=reclen-44;
    // enable "save" button
    ui->pushButton_3->setEnabled(true);
    // setup output device (using default device)
    if (!BASS_Init(-1,44100,0,NULL,NULL)) {
        QDEBUG(BASS_ErrorGetCode());
        QDEBUG("Can't initialize output device");
        return;
    }
    // create a stream from the recording
    if (chan=BASS_StreamCreateFile(TRUE,recbuf,0,reclen,BASS_SAMPLE_FLOAT)) {
        //ui->pushButton_2->setEnabled(true); // enable "play" button
    }
    else
        BASS_Free();
    ui->pushButton->setEnabled(true);
}
开发者ID:lovelycodex,项目名称:diplom,代码行数:33,代码来源:widget.cpp

示例5: StopRecording

void StopRecording()
{
	BASS_ChannelStop(rchan);
	rchan=0;
	{ // complete the WAVE header
		DWORD len=ftell(rfp),v;
		fseek(rfp,4,SEEK_SET);
		v=len-8;
		fwrite(&v,1,4,rfp);
		fseek(rfp,40,SEEK_SET);
		v=len-44;
		fwrite(&v,1,4,rfp);
		fclose(rfp);
	}
	MESS(10,WM_SETTEXT,0,L"Record");
	// setup output device (using default device)
	if (!BASS_Init(-1,44100,0,NULL,NULL)) {
		Error(L"Can't initialize output device");
		return;
	}
	// create a stream from the recording
	if (chan=BASS_StreamCreateFile(FALSE,L"bass.wav",0,0,BASS_UNICODE))
		EnableWindow(DLGITEM(11),TRUE); // enable "play" button
	else 
		BASS_Free();
}
开发者ID:AlexanderMykulych,项目名称:Game_Dragons_Qt,代码行数:26,代码来源:rectest.c

示例6: StartRecording

void StartRecording()
{
	WAVEFORMATEX *wf;
	if (recbuf) { // free old recording
		BASS_StreamFree(chan);
		chan=0;
		free(recbuf);
		recbuf=NULL;
		EnableWindow(DLGITEM(11),FALSE);
		EnableWindow(DLGITEM(12),FALSE);
		// close output device before recording incase of half-duplex device
		BASS_Free();
	}
	// allocate initial buffer and make space for WAVE header
	recbuf=malloc(BUFSTEP);
	reclen=44;
	// fill the WAVE header
	memcpy(recbuf,"RIFF\0\0\0\0WAVEfmt \20\0\0\0",20);
	memcpy(recbuf+36,"data\0\0\0\0",8);
	wf=(WAVEFORMATEX*)(recbuf+20);
	wf->wFormatTag=1;
	wf->nChannels=2;
	wf->wBitsPerSample=16;
	wf->nSamplesPerSec=44100;
	wf->nBlockAlign=wf->nChannels*wf->wBitsPerSample/8;
	wf->nAvgBytesPerSec=wf->nSamplesPerSec*wf->nBlockAlign;
	// start recording @ 44100hz 16-bit stereo
	if (!(rchan=BASS_RecordStart(44100,2,0,&RecordingCallback,0))) {
		Error("Couldn't start recording");
		free(recbuf);
		recbuf=0;
		return;
	}
	MESS(10,WM_SETTEXT,0,"Stop");
}
开发者ID:madnessw,项目名称:thesnow,代码行数:35,代码来源:rectest.c

示例7: StartRecording

void StartRecording()
{
	WAVEFORMATEX wf;
	if (chan) { // free old recording
		BASS_StreamFree(chan);
		chan=0;
		EnableWindow(DLGITEM(11),FALSE);
		// close output device before recording incase of half-duplex device
		BASS_Free();
	}
	// open the output file
	if (!(rfp=_wfopen(L"bass.wav",L"wb"))) {
		Error(L"Can't create the file");
		return;
	}
	// write the WAVE header
	fwrite("RIFF\0\0\0\0WAVEfmt \20\0\0\0",1,20,rfp);
	wf.wFormatTag=WAVE_FORMAT_PCM;
	wf.nChannels=1;
	wf.wBitsPerSample=16;
	wf.nSamplesPerSec=44100;
	wf.nBlockAlign=wf.nChannels*wf.wBitsPerSample/8;
	wf.nAvgBytesPerSec=wf.nSamplesPerSec*wf.nBlockAlign;
	fwrite(&wf,1,16,rfp);
	fwrite("data\0\0\0\0",1,8,rfp);
	// start recording @ 44100hz 16-bit mono
	if (!(rchan=BASS_RecordStart(44100,1,0,&RecordingCallback,0))) {
		Error(L"Couldn't start recording");
		fclose(rfp);
		return;
	}
	MESS(10,WM_SETTEXT,0,L"Stop");
}
开发者ID:AlexanderMykulych,项目名称:Game_Dragons_Qt,代码行数:33,代码来源:rectest.c

示例8: BASS_StreamFree

void Music::Stop()
{
	if (mp3Strewam != NULL)
		BASS_StreamFree(mp3Strewam);

	BASS_Free();
}
开发者ID:asmCode,项目名称:rw2014,代码行数:7,代码来源:Music.cpp

示例9: print_bass_error

/* Display error messages */
void print_bass_error(const char *text)
{
  printf("Error(%d): %s\n", BASS_ErrorGetCode(), text);
  BASS_Free();
  exit(1);

} /* print_bass_error */
开发者ID:cutecycle,项目名称:Rikachan-Android,代码行数:8,代码来源:bassplayer.cpp

示例10: BASS_StreamFree

/**
 * @brief Starts the record and set default confuration for audio file. If start record is failure free RECBUF is comming.
 */
void Widget::startRecording() {
    WAVEFORMATEX *wf;
    if (recbuf) { // free old recording;
        BASS_StreamFree(chan);
        chan=0;
        free(recbuf);
        recbuf=NULL;
        //ui->pushButton_2->setEnabled(false);
        ui->pushButton_3->setEnabled(false);
        // close output device before recording incase of half-duplex device;
        BASS_Free();
    }
    // allocate initial buffer and make space for WAVE header;
    recbuf=(char*)malloc(BUFSTEP);
    reclen=44;
    // fill the WAVE header;
    memcpy(recbuf,"RIFF\0\0\0\0WAVEfmt \20\0\0\0",20);
    memcpy(recbuf+36,"data\0\0\0\0",8);
    wf=(WAVEFORMATEX*)(recbuf+20);
    wf->wFormatTag=1;
    wf->nChannels=2;
    wf->wBitsPerSample=16;
    wf->nSamplesPerSec=44100;
    wf->nBlockAlign=wf->nChannels*wf->wBitsPerSample/8;
    wf->nAvgBytesPerSec=wf->nSamplesPerSec*wf->nBlockAlign;
    // start recording @ 44100hz 32-bit stereo;
    if (!(rchan=BASS_RecordStart(44100,2,0,&RecordingCallback,0))) {
        QDEBUG(BASS_ErrorGetCode());
        Error("Couldn't start recording");
        free(recbuf);
        recbuf=0;
        return;
    }
    ui->pushButton->setEnabled(false);
}
开发者ID:lovelycodex,项目名称:diplom,代码行数:38,代码来源:widget.cpp

示例11: BASS_RecordFree

/**
 * @brief Widget::~Widget Defaul destructor.
 */
Widget::~Widget()
{
    // release all BASS stuff;
    delete fft;
    BASS_RecordFree();
    BASS_Free();
    delete ui;
}
开发者ID:lovelycodex,项目名称:diplom,代码行数:11,代码来源:widget.cpp

示例12: BASS_Free

void ds::Audio::Release( )
{
	BASS_Free( );

	FreeLibrary( Library );

	Library = 0;
}
开发者ID:Majchrzak,项目名称:Drops,代码行数:8,代码来源:Audio.cpp

示例13: killSoundStuff

void killSoundStuff () {
	if (soundOK) {
		int a;
		for (a = 0; a < MAX_MODS;		a ++) stopMOD	(a);
		for (a = 0; a < MAX_SAMPLES;	a ++) freeSound	(a);
		BASS_Free();
	}
}
开发者ID:opensludge,项目名称:opensludge,代码行数:8,代码来源:sound_bass.cpp

示例14: RemoveAll

CAudioManager::~CAudioManager()
{
	// Remove all audio
	RemoveAll();

	// Free the BASS audio library
	BASS_Free();
}
开发者ID:AgresivD,项目名称:ivmultiplayer,代码行数:8,代码来源:CAudioManager.cpp

示例15: BASS_ChannelStop

CSoundManager::~CSoundManager() {
	if (m_stream != NULL) {
        BASS_ChannelStop(m_stream);
		BASS_StreamFree(m_stream);
	}

	BASS_Free();
}
开发者ID:AndreySeVeN,项目名称:ouzo-game,代码行数:8,代码来源:sound_manager.cpp


注:本文中的BASS_Free函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。