Exemple #1
0
// 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);
}
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");
}
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);
    }
}
Exemple #4
0
/**
 * @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);
}
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();
}
Exemple #6
0
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");
}
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");
}
Exemple #8
0
void Music::Stop()
{
	if (mp3Strewam != NULL)
		BASS_StreamFree(mp3Strewam);

	BASS_Free();
}
/* 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 */
Exemple #10
0
/**
 * @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);
}
Exemple #11
0
/**
 * @brief Widget::~Widget Defaul destructor.
 */
Widget::~Widget()
{
    // release all BASS stuff;
    delete fft;
    BASS_RecordFree();
    BASS_Free();
    delete ui;
}
Exemple #12
0
void ds::Audio::Release( )
{
	BASS_Free( );

	FreeLibrary( Library );

	Library = 0;
}
Exemple #13
0
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();
	}
}
CAudioManager::~CAudioManager()
{
	// Remove all audio
	RemoveAll();

	// Free the BASS audio library
	BASS_Free();
}
CSoundManager::~CSoundManager() {
	if (m_stream != NULL) {
        BASS_ChannelStop(m_stream);
		BASS_StreamFree(m_stream);
	}

	BASS_Free();
}
Exemple #16
0
void error(char *reason){
	free_textures();
	if (music_file) BASS_StreamFree( music_file );
	if (fp) file_close( fp );
	BASS_Free();
	d3dwin_close();
	MessageBox(NULL, reason, NULL, MB_OK);
	exit(1);
}
HRESULT CBSoundMgr::Cleanup()
{
	for(int i=0; i<m_Sounds.GetSize(); i++) delete m_Sounds[i];
	m_Sounds.RemoveAll();

	BASS_Free();

	return S_OK;
}
Exemple #18
0
int OnShutdown(WPARAM, LPARAM)
{
	if (hBass != NULL) {
		BASS_Free();
		FreeLibrary(hBass);
	}

	DeleteFrame();
	return 0;
}
/// <summary>
/// Finalizes data.
/// </summary>
void CSoundManager::Done ()
{
	if (IsOk())
	{
		BASS_Stop();
		BASS_Free();
		Release();
		m_bIsOk = false;
	}
}
Exemple #20
0
KNMusicBackendBass::~KNMusicBackendBass()
{
    //Free all the plugin to recover the memory.
    while(!m_pluginList.isEmpty())
    {
        BASS_PluginFree(m_pluginList.takeFirst());
    }
    //Close the bass.
    BASS_Free();
}
BOOL APIENTRY TestDlgProc (HWND hDlg, UINT message, UINT wParam, LONG lParam) 
        { 
    switch (message) 
        { 
    case WM_CLOSE:
		// 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();
   	EndDialog(hDlg,TRUE); 
   	break;
	case WM_INITDIALOG:
	CheckExtensionsProc(hDlg);
		 break;
	case WM_COMMAND:
   			switch(LOWORD(wParam))
   			{
   			case IDC_DUMPINFO:
			DumpOGLDriverInformation();
			break;
			case IDC_CREDITS:
			MessageBox(hDlg,"Programming and Core Design: Brad 'mudlord' Miller\nGFX:   Brad 'mudlord' Miller\nSFX:   Dubmood/Razor 1911\n\nSound system by Ian Luck\n\n(C) 2007-2008 Brad Miller ([email protected])\nhttp://vba-m.ngemu.com\nAll rights reserved\n\nThis tool is written only for Glide64 and the 'Glitch64' wrapper. Nothing else.\nThis is NOT to be distributed out of the Glide64 package without the proper written consent of the author.", "Credits",MB_TASKMODAL|MB_ICONINFORMATION);
			break;
			case IDC_TEXTUREBUTTON:
			MessageBox(hDlg,"Multitexturing is a vital feature required for the wrapper.\nMultitexturing is a video card feature that allows for two or more textures to be mapped to one 2D/3D object in one rendering pass.", "Multitexturing Information",MB_TASKMODAL|MB_ICONINFORMATION);
			break;
			case IDC_GLSLBUTTON:
			MessageBox(hDlg,"GLSL (pixel and vertex shader) support is a highly recommended feature, to be supported.\nGLSL support allows for the advanced GLSL shader-based combiner used in the wrapper. This is needed for advanced blending features and special effects such as dithered alpha rendering.\nIt is highly recommended that this is supported for optimal wrapper rendering and support.\n\nA modern video card (such as a ATI Radeon 9600 or a GeForce FX5200) is needed for GLSL combiner support.", "Pixel and Vertex Shader (GLSL) Information",MB_TASKMODAL|MB_ICONINFORMATION);
			break;
			case IDC_FBOBUTTON:
			MessageBox(hDlg,"Framebuffer object support is a recommended feature to be supported by the video card, for use in Glitch64.\n\nFramebuffer object support allows for hardware framebuffer emulation to be supported,\ndue to framebuffer objects being used to allow for hardware-accelerated render to texture, as well as for auxiliary video rendering buffer allocation.\nHowever, framebuffer object usage in the wrapper can be disabled, and glCopyTexImage2D-based render to texture can be used instead, which is supported on all OpenGL compliant video cards.\n\nA modern video card with OpenGL 1.5 support (such as a ATI Radeon 9600 or a GeForce FX5200) is needed for framebuffer object utilization.", "Framebuffer Object Information",MB_TASKMODAL|MB_ICONINFORMATION);
			break;
			case IDC_NPOTBUTTON:
			MessageBox(hDlg,"Non power of two texture support is a completely optional feature.\n\nTextures that are not in a power of two often use less space than textures that are scaled in powers of 2.\nNon-power of two texture support, allows for textures that are not in a power of two, to be used in rendering. Thus, due to the absence of texture scaling to powers of two, VRAM can be saved as textures do not need to be scaled up to a power of two.\n\nA modern video card with OpenGL 2.0 (such as a GeForce 6 6600GT)  support is needed for non power of two texture support.", "Non Power of Two Texture Information",MB_TASKMODAL|MB_ICONINFORMATION);
			break;
			case IDC_S3TCBUTTON:
			MessageBox(hDlg,"S3TC texture compression support is a optional (but recommended) feature.\n\nS3TC texture compression allows for more efficient use of video memory, due to support for textures that are being compressed. This has a quality tradeoff however, when S3TC texture compression is enabled in the texture enhancement module, 'GlideHQ'.", "S3TC Texture Compression Information",MB_TASKMODAL|MB_ICONINFORMATION);
			break;
			case IDC_FXT1BUTTON:
			MessageBox(hDlg,"FXT1 texture compression support is a completely optional feature.\n\nFXT1 texture compression is a proprietary 3dfx compression method. It is currently only supported on 3dfx and Intel-based video cards and chipsets. FXT1 texture compression is used as a alternative to S3TC texture compression.", "FXT1 Texture Compression Information",MB_TASKMODAL|MB_ICONINFORMATION);
			break;
			case IDC_PACKEDPIXELS:
			MessageBox(hDlg,"Packed pixel support is a strongly recommended feature used in Glitch64\n\nPacked pixel support is used in Glitch64 for correct texture format conversions, to assist with image quality.", "Packed Pixel Information",MB_TASKMODAL|MB_ICONINFORMATION);
			break;
   			}
 		default:
   			return FALSE;
   }   
   return TRUE;
}
// --[  Method  ]---------------------------------------------------------------
//
//  - Class     : CSoundSystem
//  - prototype : bool Close()
//
//  - Purpose   : Stops all currently playing songs, deallocates them and closes
//                the sound system.
//
// -----------------------------------------------------------------------------
bool CSoundSystem::Close()
{
    if(!IsActive())
    {
        return false;
    }

    BASS_Free();
    m_bActive = false;
    return true;
}
Exemple #23
0
int main(int argc, char* argv[])
{
	IBNibRef 		nibRef;
	OSStatus		err;
	
	InitCursor();

	// check the correct BASS was loaded
	if (HIWORD(BASS_GetVersion())!=BASSVERSION) {
		Error("An incorrect version of BASS.DLL was loaded (2.4 is required)");
		return 0;
	}

	// check the correct BASS_FX was loaded
	if (HIWORD(BASS_FX_GetVersion())!=BASSVERSION) {
		Error("An incorrect version of BASS_FX.DLL was loaded (2.4 is required)");
		return 0;
	}

	// initialize default output device
	if(!BASS_Init(-1,44100,0,NULL,NULL)) {
		Error("Can't initialize device");
		return 0;
	}

	// Create Window and Stuff
	err = CreateNibReference(CFSTR("reverse"), &nibRef);
	if (err) return err;
	err = CreateWindowFromNib(nibRef, CFSTR("MainWindow"), &win);
	if (err) return err;
	DisposeNibReference(nibRef);

	SetupControlHandler(10,kEventControlHit,OpenEventHandler);
	SetControlAction(GetControl(11),NewControlActionUPP(VolEventHandler));
	SetControlAction(GetControl(13),NewControlActionUPP(TempoEventHandler));
	SetControlAction(GetControl(15),NewControlActionUPP(PosEventHandler));
	SetupControlHandler(16,kEventControlHit,DirEventHandler);

	EventLoopTimerRef timer;
	InstallEventLoopTimer(GetCurrentEventLoop(),kEventDurationNoWait,kEventDurationSecond/2,TimerProc,0,&timer);

	// The window was created hidden so show it.
	ShowWindow(win);
    
	// Call the event loop
	RunApplicationEventLoop();
   
	// Close output
	BASS_Free();

	return 0;
}
Exemple #24
0
int main(int argc, char* argv[])
{
	regex_t fregex;

	gtk_init(&argc,&argv);

	// check the correct BASS was loaded
	if (HIWORD(BASS_GetVersion())!=BASSVERSION) {
		Error("An incorrect version of BASS was loaded");
		return 0;
	}

	// enable floating-point DSP (not really necessary as the channels will be floating-point anyway)
	BASS_SetConfig(BASS_CONFIG_FLOATDSP,TRUE);

	// initialize default device
	if (!BASS_Init(-1,44100,0,NULL,NULL)) {
		Error("Can't initialize device");
		return 0;
	}

	// initialize GUI
	glade=glade_xml_new(GLADE_PATH"dsptest.glade",NULL,NULL);
	if (!glade) return 0;
	win=GetWidget("window1");
	if (!win) return 0;
	glade_xml_signal_autoconnect(glade);

	{ // initialize file selector
		GtkFileFilter *filter;
		filesel=gtk_file_chooser_dialog_new("Open File",GTK_WINDOW(win),GTK_FILE_CHOOSER_ACTION_OPEN,
			GTK_STOCK_CANCEL,GTK_RESPONSE_CANCEL,GTK_STOCK_OPEN,GTK_RESPONSE_ACCEPT,NULL);
		filter=gtk_file_filter_new();
		gtk_file_filter_set_name(filter,"Playable files");
		regcomp(&fregex,"\\.(mo3|xm|mod|s3m|it|umx|mp[1-3]|ogg|wav|aif)$",REG_ICASE|REG_NOSUB|REG_EXTENDED);
		gtk_file_filter_add_custom(filter,GTK_FILE_FILTER_FILENAME,FileExtensionFilter,&fregex,NULL);
		gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(filesel),filter);
		filter=gtk_file_filter_new();
		gtk_file_filter_set_name(filter,"All files");
		gtk_file_filter_add_pattern(filter,"*");
		gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(filesel),filter);
	}

	gtk_main();

	gtk_widget_destroy(filesel);
	regfree(&fregex);

	BASS_Free();

    return 0;
}
Exemple #25
0
static BOOL Initialize()
{
	BASS_INFO bi;
	// initialize output, get latency
	if (!BASS_Init(-1,44100,BASS_DEVICE_LATENCY,win,NULL)) {
		Error("Can't initialize output");
		return FALSE;
	}

	BASS_GetInfo(&bi);
	if (bi.dsver<8) { // no DX8, so disable effect buttons
		EnableWindow(GetDlgItem(win,20),FALSE);
		EnableWindow(GetDlgItem(win,21),FALSE);
		EnableWindow(GetDlgItem(win,22),FALSE);
		EnableWindow(GetDlgItem(win,23),FALSE);
	}

	// create a stream to play the recording
	chan=BASS_StreamCreate(44100,2,0,STREAMPROC_PUSH,0);

	// start recording with 10ms period
	if (!BASS_RecordInit(-1) || !(rchan=BASS_RecordStart(44100,2,MAKELONG(0,10),RecordingCallback,0))) {
		BASS_RecordFree();
		BASS_Free();
		Error("Can't initialize recording");
		return FALSE;
	}

	{ // get list of inputs
		int c;
		const char *i;
		for (c=0;i=BASS_RecordGetInputName(c);c++) {
			float level;
			MESS(10,CB_ADDSTRING,0,i);
			if (!(BASS_RecordGetInput(c,&level)&BASS_INPUT_OFF)) { // this 1 is currently "on"
				input=c;
				MESS(10,CB_SETCURSEL,input,0);
				MESS(11,TBM_SETPOS,TRUE,level*100); // set level slider
			}
		}
	}

	{ // prebuffer at least "minbuf" amount of data before starting playback
		DWORD prebuf=BASS_ChannelSeconds2Bytes(chan,bi.minbuf/1000.f);
		while (BASS_ChannelGetData(chan,NULL,BASS_DATA_AVAILABLE)<prebuf)
			Sleep(1);
	}
	BASS_ChannelPlay(chan,FALSE);

	return TRUE;
}
Exemple #26
0
int OnFoldersChanged(WPARAM, LPARAM)
{
	FoldersGetCustomPathT(hBASSFolder, CurrBassPath, MAX_PATH, _T(""));
	mir_tstrcat(CurrBassPath, _T("\\bass.dll"));

	if (hBass != NULL) {
		BASS_Free();
		FreeLibrary(hBass);
		UnhookEvent(hPlaySound);
		DeleteFrame();
	}
	LoadBassLibrary(CurrBassPath);

	return 0;
}
bool Program::initializeAudioDevice()
{
	BASS_Free();
	if (BASS_Init(-1, 44100, BASS_DEVICE_3D, NULL, NULL))
	{
		loadPlugins();
		BASS_SetConfig(BASS_CONFIG_NET_PLAYLIST, 1);
		BASS_SetConfig(BASS_CONFIG_NET_TIMEOUT, settings->connectTimeout);
		BASS_SetConfig(BASS_CONFIG_WMA_BASSFILE, 1);
		BASS_SetEAXParameters(-1, 0.0f, -1.0f, -1.0f);
		return true;
	}
	logText(boost::str(boost::format("Error initializing audio device: %1%") % core->getAudio()->getErrorMessage()));
	return false;
}
Exemple #28
0
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow)
{
	inst=hInstance;

	// Check that BASS 1.8 was loaded
	if (BASS_GetVersion()!=MAKELONG(1,8)) {
		MessageBox(0,"BASS version 1.8 was not loaded","Incorrect BASS.DLL",0);
		return 0;
	}

	DialogBox(inst,(char*)1000,0,&dialogproc);

	BASS_Free();

	return 0;
}
Exemple #29
0
bool BassPlayer::closeAllDevices() {
    bool ret = true;

    for(QHash<int, bool>::Iterator it = opened_devices.begin(); it != opened_devices.end(); it++) {
        bool op_res = BASS_SetDevice(it.key()) && BASS_Free();

        if (!op_res)
            qCritical() << "DEVICE CLOSE ERROR" << BASS_ErrorGetCode();

        ret &= op_res;
    }

    opened_devices.clear();

    return ret;
}
Exemple #30
0
int main(int argc, char* argv[])
{
	IBNibRef 		nibRef;
	OSStatus		err;

	// check the correct BASS was loaded
	if (HIWORD(BASS_GetVersion())!=BASSVERSION) {
		Error("An incorrect version of BASS was loaded");
		return 0;
	}

	// initialize default output device
	if (!BASS_Init(-1,44100,0,NULL,NULL)) {
		Error("Can't initialize device");
		return 0;
	}

	BASS_SetConfig(BASS_CONFIG_NET_PLAYLIST,1); // enable playlist processing
	BASS_SetConfig(BASS_CONFIG_NET_PREBUF,0); // minimize automatic pre-buffering, so we can do it (and display it) instead
	BASS_SetConfigPtr(BASS_CONFIG_NET_PROXY,proxy); // setup proxy server location

	// Create Window and stuff
	err = CreateNibReference(CFSTR("netradio"), &nibRef);
	if (err) return err;
	err = CreateWindowFromNib(nibRef, CFSTR("Window"), &win);
	if (err) return err;
	DisposeNibReference(nibRef);

	int a;
	for (a=10;a<20;a++)
		SetupControlHandler(a,kEventControlHit,RadioEventHandler);
	SetupControlHandler(41,kEventControlHit,DirectEventHandler);
	{
		EventTypeSpec etype={'blah','blah'};
		InstallApplicationEventHandler(NewEventHandlerUPP(CustomEventHandler),1,&etype,NULL,NULL);
	}

	ShowWindow(win);
	RunApplicationEventLoop();

	BASS_Free();

    return 0; 
}