This commit is contained in:
Michael Zhang 2021-01-05 04:17:41 -06:00
commit a443d3c7fd
262 changed files with 34324 additions and 0 deletions

3
.editorconfig Normal file
View file

@ -0,0 +1,3 @@
[*]
indent_style = space
indent_size = 4

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/target

2706
Cargo.lock generated Normal file

File diff suppressed because it is too large Load diff

18
Cargo.toml Normal file
View file

@ -0,0 +1,18 @@
[package]
name = "editor"
version = "0.1.0"
authors = ["Michael Zhang <mail@mzhang.io>"]
edition = "2018"
[workspace]
members = [
"bass-sys",
]
[dependencies]
anyhow = "1.0.37"
bass-sys = { path = "bass-sys" }
ggez = "0.5.1"
libosu = "0.0.11"
log = "0.4.11"
stderrlog = "0.5.0"

9
bass-sys/Cargo.toml Normal file
View file

@ -0,0 +1,9 @@
[package]
name = "bass-sys"
version = "0.1.0"
authors = ["Michael Zhang <iptq@protonmail.com>"]
edition = "2018"
[dependencies]
log = "0.4.11"
paste = "0.1.18"

BIN
bass-sys/bass24/bass.chm Normal file

Binary file not shown.

BIN
bass-sys/bass24/bass.dll Normal file

Binary file not shown.

2127
bass-sys/bass24/bass.txt Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,260 @@
/*
BASS 3D test
Copyright (c) 1999-2017 Un4seen Developments Ltd.
*/
#include <windows.h>
#include <commctrl.h>
#include <math.h>
#include <stdio.h>
#include "bass.h"
HWND win = NULL;
// channel (sample/music) info structure
typedef struct {
DWORD channel; // the channel
BASS_3DVECTOR pos, vel; // position,velocity
} Channel;
Channel *chans = NULL; // the channels
int chanc = 0, chan = -1; // number of channels, current channel
#define TIMERPERIOD 50 // timer period (ms)
#define MAXDIST 50 // maximum distance of the channels (m)
#define SPEED 12 // speed of the channels' movement (m/s)
// Display error dialogs
void Error(const char *es)
{
char mes[200];
sprintf(mes, "%s\n(error code: %d)", es, BASS_ErrorGetCode());
MessageBox(win, mes, 0, 0);
}
// Messaging macros
#define ITEM(id) GetDlgItem(win,id)
#define MESS(id,m,w,l) SendDlgItemMessage(win,id,m,(WPARAM)(w),(LPARAM)(l))
#define LM(m,w,l) MESS(10,m,w,l)
void UpdateDisplay()
{
HDC dc;
RECT r;
int c, x, y, cx, cy;
HBRUSH red = CreateSolidBrush(0xff);
HWND w = ITEM(30);
dc = GetDC(w);
GetClientRect(w, &r);
cx = r.right / 2;
cy = r.bottom / 2;
// clear the display
FillRect(dc, &r, (HBRUSH)GetStockObject(WHITE_BRUSH));
// Draw the listener
SelectObject(dc, GetStockObject(GRAY_BRUSH));
Ellipse(dc, cx - 4, cy - 4, cx + 4, cy + 4);
for (c = 0; c < chanc; c++) {
// If the channel's playing then update it's position
if (BASS_ChannelIsActive(chans[c].channel) == BASS_ACTIVE_PLAYING) {
// Check if channel has reached the max distance
if (chans[c].pos.z >= MAXDIST || chans[c].pos.z <= -MAXDIST)
chans[c].vel.z = -chans[c].vel.z;
if (chans[c].pos.x >= MAXDIST || chans[c].pos.x <= -MAXDIST)
chans[c].vel.x = -chans[c].vel.x;
// Update channel position
chans[c].pos.z += chans[c].vel.z * TIMERPERIOD / 1000;
chans[c].pos.x += chans[c].vel.x * TIMERPERIOD / 1000;
BASS_ChannelSet3DPosition(chans[c].channel, &chans[c].pos, NULL, &chans[c].vel);
}
// Draw the channel position indicator
x = cx + (int)((cx - 10) * chans[c].pos.x / MAXDIST);
y = cy - (int)((cy - 10) * chans[c].pos.z / MAXDIST);
SelectObject(dc, chan == c ? red : GetStockObject(WHITE_BRUSH));
Ellipse(dc, x - 4, y - 4, x + 4, y + 4);
}
// Apply the 3D changes
BASS_Apply3D();
ReleaseDC(w, dc);
DeleteObject(red);
}
// Update the button states
void UpdateButtons()
{
int a;
for (a = 12; a <= 17; a++)
EnableWindow(ITEM(a), chan == -1 ? FALSE : TRUE);
if (chan != -1) {
SetDlgItemInt(win, 15, abs((int)chans[chan].vel.x), FALSE);
SetDlgItemInt(win, 16, abs((int)chans[chan].vel.z), FALSE);
}
}
INT_PTR CALLBACK dialogproc(HWND h, UINT m, WPARAM w, LPARAM l)
{
static OPENFILENAME ofn;
switch (m) {
case WM_TIMER:
UpdateDisplay();
break;
case WM_COMMAND:
switch (LOWORD(w)) {
case 10: // change the selected channel
if (HIWORD(w) != LBN_SELCHANGE) break;
chan = LM(LB_GETCURSEL, 0, 0);
if (chan == LB_ERR) chan = -1;
UpdateButtons();
break;
case 11: // add a channel
{
char file[MAX_PATH] = "";
DWORD newchan;
ofn.lpstrFile = file;
if (GetOpenFileName(&ofn)) {
// Load a music or sample from "file"
if ((newchan = BASS_MusicLoad(FALSE, file, 0, 0, BASS_MUSIC_RAMP | BASS_SAMPLE_LOOP | BASS_SAMPLE_3D, 1))
|| (newchan = BASS_SampleLoad(FALSE, file, 0, 0, 1, BASS_SAMPLE_LOOP | BASS_SAMPLE_3D | BASS_SAMPLE_MONO))) {
Channel *c;
chanc++;
chans = (Channel*)realloc((void*)chans, chanc * sizeof(Channel));
c = chans + chanc - 1;
memset(c, 0, sizeof(Channel));
c->channel = newchan;
BASS_SampleGetChannel(newchan, FALSE); // initialize sample channel
LM(LB_ADDSTRING, 0, strrchr(file, '\\') + 1);
} else
Error("Can't load file (note samples must be mono)");
}
}
break;
case 12: // remove a channel
{
Channel *c = chans + chan;
BASS_SampleFree(c->channel);
BASS_MusicFree(c->channel);
memmove(c, c + 1, (chanc - chan - 1) * sizeof(Channel));
chanc--;
LM(LB_DELETESTRING, chan, 0);
chan = -1;
UpdateButtons();
}
break;
case 13:
BASS_ChannelPlay(chans[chan].channel, FALSE);
break;
case 14:
BASS_ChannelPause(chans[chan].channel);
break;
case 15: // X velocity
if (HIWORD(w) == EN_CHANGE) {
int v = GetDlgItemInt(win, 15, 0, FALSE);
if (abs((int)chans[chan].vel.x) != v) chans[chan].vel.x = v;
}
break;
case 16: // Z velocity
if (HIWORD(w) == EN_CHANGE) {
int v = GetDlgItemInt(win, 16, 0, FALSE);
if (abs((int)chans[chan].vel.z) != v) chans[chan].vel.z = v;
}
break;
case 17: // reset the position and velocity to 0
memset(&chans[chan].pos, 0, sizeof(chans[chan].pos));
memset(&chans[chan].vel, 0, sizeof(chans[chan].vel));
UpdateButtons();
break;
case IDCANCEL:
DestroyWindow(h);
break;
}
break;
case WM_HSCROLL:
if (l) {
int pos = SendMessage((HWND)l, TBM_GETPOS, 0, 0);
switch (GetDlgCtrlID((HWND)l)) {
case 20: // change the rolloff factor
BASS_Set3DFactors(-1, pow(2, (pos - 10) / 5.0), -1);
break;
case 21: // change the doppler factor
BASS_Set3DFactors(-1, -1, pow(2, (pos - 10) / 5.0));
break;
}
}
break;
case WM_INITDIALOG:
win = h;
MESS(20, TBM_SETRANGE, FALSE, MAKELONG(0, 20));
MESS(20, TBM_SETPOS, TRUE, 10);
MESS(21, TBM_SETRANGE, FALSE, MAKELONG(0, 20));
MESS(21, TBM_SETPOS, TRUE, 10);
SetTimer(h, 1, TIMERPERIOD, NULL);
memset(&ofn, 0, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = h;
ofn.nMaxFile = MAX_PATH;
ofn.Flags = OFN_HIDEREADONLY | OFN_EXPLORER;
ofn.lpstrFilter = "wav/aif/mo3/xm/mod/s3m/it/mtm/umx\0*.wav;*.aif;*.mo3;*.xm;*.mod;*.s3m;*.it;*.mtm;*.umx\0"
"All files\0*.*\0\0";
return 1;
case WM_DESTROY:
KillTimer(h, 1);
if (chans) free(chans);
PostQuitMessage(0);
break;
}
return 0;
}
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
MSG msg;
// check the correct BASS was loaded
if (HIWORD(BASS_GetVersion()) != BASSVERSION) {
MessageBox(0, "An incorrect version of BASS.DLL was loaded", 0, MB_ICONERROR);
return 0;
}
{ // enable trackbar support
INITCOMMONCONTROLSEX cc = { sizeof(cc),ICC_BAR_CLASSES };
InitCommonControlsEx(&cc);
}
// Create the main window
if (!CreateDialog(hInstance, MAKEINTRESOURCE(1000), NULL, dialogproc)) {
Error("Can't create window");
return 0;
}
// Initialize the default output device with 3D support
if (!BASS_Init(-1, 44100, BASS_DEVICE_3D, win, NULL)) {
Error("Can't initialize output device");
DestroyWindow(win);
return 0;
}
// Use meters as distance unit, real world rolloff, real doppler effect
BASS_Set3DFactors(1, 1, 1);
while (GetMessage(&msg, NULL, 0, 0) > 0) {
if (!IsDialogMessage(win, &msg)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
BASS_Free();
return 0;
}

View file

@ -0,0 +1,57 @@
# Microsoft Developer Studio Project File - Name="3dtest" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=3dtest - Win32 Release
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "3dtest.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "3dtest.mak" CFG="3dtest - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "3dtest - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "../bin"
# PROP BASE Intermediate_Dir "Release"
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "../bin"
# PROP Intermediate_Dir "Release"
# ADD BASE CPP /nologo /MD /GX /I ".." /D "WIN32" /D "NDEBUG" /FD /c
# ADD CPP /nologo /MD /GX /I ".." /D "WIN32" /D "NDEBUG" /FD /c
BSC32=bscmake.exe
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib comdlg32.lib gdi32.lib comctl32.lib /nologo /subsystem:windows /pdb:none /machine:I386
# ADD LINK32 kernel32.lib user32.lib comdlg32.lib gdi32.lib comctl32.lib /nologo /subsystem:windows /pdb:none /machine:I386
# Begin Target
# Name "3dtest - Win32 Release"
# Begin Source File
SOURCE=3dtest.c
# End Source File
# Begin Source File
SOURCE=3dtest.rc
# End Source File
# Begin Source File
SOURCE=..\bass.lib
# End Source File
# End Target
# End Project

View file

@ -0,0 +1,29 @@
#include "windows.h"
1000 DIALOG DISCARDABLE 100, 100, 255, 141
STYLE WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "BASS - 3D Test"
FONT 8, "MS Sans Serif"
BEGIN
GROUPBOX "Channels (sample/music)",-1,5,0,120,111
LISTBOX 10,10,9,110,35,LBS_NOINTEGRALHEIGHT | WS_VSCROLL |
WS_TABSTOP
PUSHBUTTON "Add ...",11,12,49,50,12
PUSHBUTTON "Remove",12,68,49,50,12,WS_DISABLED
PUSHBUTTON "Play",13,12,65,50,12,WS_DISABLED
PUSHBUTTON "Stop",14,68,65,50,12,WS_DISABLED
GROUPBOX "Movement",-1,5,80,120,31
LTEXT "x:",-1,12,93,8,8
EDITTEXT 15,21,91,20,13,ES_NUMBER | WS_DISABLED
LTEXT "z:",-1,50,93,8,8
EDITTEXT 16,59,91,20,13,ES_NUMBER | WS_DISABLED
PUSHBUTTON "reset",17,88,91,30,12,WS_DISABLED
GROUPBOX "Rolloff factor",-1,5,113,120,23
CONTROL "",20,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS |
WS_TABSTOP,15,123,100,10
GROUPBOX "Doppler factor",-1,130,113,120,23
CONTROL "",21,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS |
WS_TABSTOP,140,123,100,10
GROUPBOX "",-1,130,0,120,111
LTEXT "",30,135,9,109,96,SS_SUNKEN
END

View file

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="3dtest"
ProjectGUID="{98CE30EE-9892-4896-9A68-34725FB454B8}"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory="..\bin"
ConfigurationType="1"
CharacterSet="0"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".."
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="2"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="bass.lib comctl32.lib"
AdditionalLibraryDirectories=".."
SubSystem="2"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="..\bin\x64"
ConfigurationType="1"
CharacterSet="0"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".."
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="2"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="bass.lib comctl32.lib"
AdditionalLibraryDirectories="..\x64"
SubSystem="2"
TargetMachine="17"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath="3dtest.c"
>
</File>
<File
RelativePath="3dtest.rc"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{98CE30EE-9892-4896-9A68-34725FB454B8}</ProjectGuid>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>..\bin\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>..\bin\x64\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<AdditionalDependencies>bass.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<SubSystem>Windows</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<AdditionalDependencies>bass.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="3dtest.c" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="3dtest.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View file

@ -0,0 +1,10 @@
include ..\makefile.in
TARGET = 3dtest.exe
FLAGS += -mwindows
LIBS += -lcomdlg32 -lcomctl32 -lgdi32
all: $(TARGET)
clean:
$(RM) $(OUTDIR)\$(TARGET)

233
bass-sys/bass24/c/bass.dsw Normal file
View file

@ -0,0 +1,233 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "3dtest"=.\3dtest\3dtest.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "BASStest"=.\basstest\basstest.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "contest"=.\contest\contest.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "custloop"=.\custloop\custloop.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "devlist"=.\devlist\devlist.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "dsptest"=.\dsptest\dsptest.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "fxtest"=.\fxtest\fxtest.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "livefx"=.\livefx\livefx.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "livespec"=.\livespec\livespec.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "modtest"=.\modtest\modtest.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "multi"=.\multi\multi.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "netradio"=.\netradio\netradio.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "plugins"=.\plugins\plugins.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "rectest"=.\rectest\rectest.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "speakers"=.\speakers\speakers.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "spectrum"=.\spectrum\spectrum.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "synth"=.\synth\synth.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "writewav"=.\writewav\writewav.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

1160
bass-sys/bass24/c/bass.h Normal file

File diff suppressed because it is too large Load diff

BIN
bass-sys/bass24/c/bass.lib Normal file

Binary file not shown.

120
bass-sys/bass24/c/bass.sln Normal file
View file

@ -0,0 +1,120 @@
Microsoft Visual Studio Solution File, Format Version 11.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "3dtest", "3dtest\3dtest.vcxproj", "{98CE30EE-9892-4896-9A68-34725FB454B8}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "basstest", "basstest\basstest.vcxproj", "{DEE82226-C3D7-4C31-A234-8934FC43EF82}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "contest", "contest\contest.vcxproj", "{1151BD42-BAB0-4C67-A3CA-D23457250C41}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "custloop", "custloop\custloop.vcxproj", "{BC8FF451-F01D-404B-B39A-D7C59A567D95}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "devlist", "devlist\devlist.vcxproj", "{1151BD42-BAB0-4C67-A3CA-D23457250C42}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dsptest", "dsptest\dsptest.vcxproj", "{89104783-85C4-4E31-9EDC-FAF7D6792BF0}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fxtest", "fxtest\fxtest.vcxproj", "{46119084-C4AA-4240-A2D6-A6AFC1A82106}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "livefx", "livefx\livefx.vcxproj", "{0C580261-3DF5-4160-BE1A-17BCC66BEE8C}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "livespec", "livespec\livespec.vcxproj", "{6AAE12B9-8731-4CDE-BD76-EC5B4EC5AE48}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "modtest", "modtest\modtest.vcxproj", "{9465CD7D-3DAC-472F-AA85-DD144AC094F7}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "multi", "multi\multi.vcxproj", "{305E5C8D-85DB-4E36-A82E-856BC9972413}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "netradio", "netradio\netradio.vcxproj", "{DFA5AC9E-4073-4555-92E8-E4808EE32B43}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "plugins", "plugins\plugins.vcxproj", "{9465CD7D-3DAC-472F-AA85-DD144AC094F0}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rectest", "rectest\rectest.vcxproj", "{4FD2AD5D-39B5-4B75-A79F-93D6DD15A06B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "speakers", "speakers\speakers.vcxproj", "{FD419538-B54A-4472-8DA6-3BDE8DDBA1F1}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "spectrum", "spectrum\spectrum.vcxproj", "{BDCC1DDE-3BAB-436C-934A-348C76B050E2}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "synth", "synth\synth.vcxproj", "{F710CC47-BAAF-44DD-9F1B-D7F5AEEEDB56}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "writewav", "writewav\writewav.vcxproj", "{6102AFDE-AFAD-4750-AC38-75DDC9268531}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{98CE30EE-9892-4896-9A68-34725FB454B8}.Release|Win32.ActiveCfg = Release|Win32
{98CE30EE-9892-4896-9A68-34725FB454B8}.Release|Win32.Build.0 = Release|Win32
{98CE30EE-9892-4896-9A68-34725FB454B8}.Release|x64.ActiveCfg = Release|x64
{98CE30EE-9892-4896-9A68-34725FB454B8}.Release|x64.Build.0 = Release|x64
{DEE82226-C3D7-4C31-A234-8934FC43EF82}.Release|Win32.ActiveCfg = Release|Win32
{DEE82226-C3D7-4C31-A234-8934FC43EF82}.Release|Win32.Build.0 = Release|Win32
{DEE82226-C3D7-4C31-A234-8934FC43EF82}.Release|x64.ActiveCfg = Release|x64
{DEE82226-C3D7-4C31-A234-8934FC43EF82}.Release|x64.Build.0 = Release|x64
{1151BD42-BAB0-4C67-A3CA-D23457250C41}.Release|Win32.ActiveCfg = Release|Win32
{1151BD42-BAB0-4C67-A3CA-D23457250C41}.Release|Win32.Build.0 = Release|Win32
{1151BD42-BAB0-4C67-A3CA-D23457250C41}.Release|x64.ActiveCfg = Release|x64
{1151BD42-BAB0-4C67-A3CA-D23457250C41}.Release|x64.Build.0 = Release|x64
{BC8FF451-F01D-404B-B39A-D7C59A567D95}.Release|Win32.ActiveCfg = Release|Win32
{BC8FF451-F01D-404B-B39A-D7C59A567D95}.Release|Win32.Build.0 = Release|Win32
{BC8FF451-F01D-404B-B39A-D7C59A567D95}.Release|x64.ActiveCfg = Release|x64
{BC8FF451-F01D-404B-B39A-D7C59A567D95}.Release|x64.Build.0 = Release|x64
{1151BD42-BAB0-4C67-A3CA-D23457250C42}.Release|Win32.ActiveCfg = Release|Win32
{1151BD42-BAB0-4C67-A3CA-D23457250C42}.Release|Win32.Build.0 = Release|Win32
{1151BD42-BAB0-4C67-A3CA-D23457250C42}.Release|x64.ActiveCfg = Release|x64
{1151BD42-BAB0-4C67-A3CA-D23457250C42}.Release|x64.Build.0 = Release|x64
{89104783-85C4-4E31-9EDC-FAF7D6792BF0}.Release|Win32.ActiveCfg = Release|Win32
{89104783-85C4-4E31-9EDC-FAF7D6792BF0}.Release|Win32.Build.0 = Release|Win32
{89104783-85C4-4E31-9EDC-FAF7D6792BF0}.Release|x64.ActiveCfg = Release|x64
{89104783-85C4-4E31-9EDC-FAF7D6792BF0}.Release|x64.Build.0 = Release|x64
{46119084-C4AA-4240-A2D6-A6AFC1A82106}.Release|Win32.ActiveCfg = Release|Win32
{46119084-C4AA-4240-A2D6-A6AFC1A82106}.Release|Win32.Build.0 = Release|Win32
{46119084-C4AA-4240-A2D6-A6AFC1A82106}.Release|x64.ActiveCfg = Release|x64
{46119084-C4AA-4240-A2D6-A6AFC1A82106}.Release|x64.Build.0 = Release|x64
{0C580261-3DF5-4160-BE1A-17BCC66BEE8C}.Release|Win32.ActiveCfg = Release|Win32
{0C580261-3DF5-4160-BE1A-17BCC66BEE8C}.Release|Win32.Build.0 = Release|Win32
{0C580261-3DF5-4160-BE1A-17BCC66BEE8C}.Release|x64.ActiveCfg = Release|x64
{0C580261-3DF5-4160-BE1A-17BCC66BEE8C}.Release|x64.Build.0 = Release|x64
{6AAE12B9-8731-4CDE-BD76-EC5B4EC5AE48}.Release|Win32.ActiveCfg = Release|Win32
{6AAE12B9-8731-4CDE-BD76-EC5B4EC5AE48}.Release|Win32.Build.0 = Release|Win32
{6AAE12B9-8731-4CDE-BD76-EC5B4EC5AE48}.Release|x64.ActiveCfg = Release|x64
{6AAE12B9-8731-4CDE-BD76-EC5B4EC5AE48}.Release|x64.Build.0 = Release|x64
{9465CD7D-3DAC-472F-AA85-DD144AC094F7}.Release|Win32.ActiveCfg = Release|Win32
{9465CD7D-3DAC-472F-AA85-DD144AC094F7}.Release|Win32.Build.0 = Release|Win32
{9465CD7D-3DAC-472F-AA85-DD144AC094F7}.Release|x64.ActiveCfg = Release|x64
{9465CD7D-3DAC-472F-AA85-DD144AC094F7}.Release|x64.Build.0 = Release|x64
{305E5C8D-85DB-4E36-A82E-856BC9972413}.Release|Win32.ActiveCfg = Release|Win32
{305E5C8D-85DB-4E36-A82E-856BC9972413}.Release|Win32.Build.0 = Release|Win32
{305E5C8D-85DB-4E36-A82E-856BC9972413}.Release|x64.ActiveCfg = Release|x64
{305E5C8D-85DB-4E36-A82E-856BC9972413}.Release|x64.Build.0 = Release|x64
{DFA5AC9E-4073-4555-92E8-E4808EE32B43}.Release|Win32.ActiveCfg = Release|Win32
{DFA5AC9E-4073-4555-92E8-E4808EE32B43}.Release|Win32.Build.0 = Release|Win32
{DFA5AC9E-4073-4555-92E8-E4808EE32B43}.Release|x64.ActiveCfg = Release|x64
{DFA5AC9E-4073-4555-92E8-E4808EE32B43}.Release|x64.Build.0 = Release|x64
{9465CD7D-3DAC-472F-AA85-DD144AC094F0}.Release|Win32.ActiveCfg = Release|Win32
{9465CD7D-3DAC-472F-AA85-DD144AC094F0}.Release|Win32.Build.0 = Release|Win32
{9465CD7D-3DAC-472F-AA85-DD144AC094F0}.Release|x64.ActiveCfg = Release|x64
{9465CD7D-3DAC-472F-AA85-DD144AC094F0}.Release|x64.Build.0 = Release|x64
{4FD2AD5D-39B5-4B75-A79F-93D6DD15A06B}.Release|Win32.ActiveCfg = Release|Win32
{4FD2AD5D-39B5-4B75-A79F-93D6DD15A06B}.Release|Win32.Build.0 = Release|Win32
{4FD2AD5D-39B5-4B75-A79F-93D6DD15A06B}.Release|x64.ActiveCfg = Release|x64
{4FD2AD5D-39B5-4B75-A79F-93D6DD15A06B}.Release|x64.Build.0 = Release|x64
{FD419538-B54A-4472-8DA6-3BDE8DDBA1F1}.Release|Win32.ActiveCfg = Release|Win32
{FD419538-B54A-4472-8DA6-3BDE8DDBA1F1}.Release|Win32.Build.0 = Release|Win32
{FD419538-B54A-4472-8DA6-3BDE8DDBA1F1}.Release|x64.ActiveCfg = Release|x64
{FD419538-B54A-4472-8DA6-3BDE8DDBA1F1}.Release|x64.Build.0 = Release|x64
{BDCC1DDE-3BAB-436C-934A-348C76B050E2}.Release|Win32.ActiveCfg = Release|Win32
{BDCC1DDE-3BAB-436C-934A-348C76B050E2}.Release|Win32.Build.0 = Release|Win32
{BDCC1DDE-3BAB-436C-934A-348C76B050E2}.Release|x64.ActiveCfg = Release|x64
{BDCC1DDE-3BAB-436C-934A-348C76B050E2}.Release|x64.Build.0 = Release|x64
{F710CC47-BAAF-44DD-9F1B-D7F5AEEEDB56}.Release|Win32.ActiveCfg = Release|Win32
{F710CC47-BAAF-44DD-9F1B-D7F5AEEEDB56}.Release|Win32.Build.0 = Release|Win32
{F710CC47-BAAF-44DD-9F1B-D7F5AEEEDB56}.Release|x64.ActiveCfg = Release|x64
{F710CC47-BAAF-44DD-9F1B-D7F5AEEEDB56}.Release|x64.Build.0 = Release|x64
{6102AFDE-AFAD-4750-AC38-75DDC9268531}.Release|Win32.ActiveCfg = Release|Win32
{6102AFDE-AFAD-4750-AC38-75DDC9268531}.Release|Win32.Build.0 = Release|Win32
{6102AFDE-AFAD-4750-AC38-75DDC9268531}.Release|x64.ActiveCfg = Release|x64
{6102AFDE-AFAD-4750-AC38-75DDC9268531}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,282 @@
/*
BASS simple playback test
Copyright (c) 1999-2019 Un4seen Developments Ltd.
*/
#include <windows.h>
#include <commctrl.h>
#include <stdio.h>
#include "bass.h"
HWND win = NULL;
HSTREAM *strs = NULL;
int strc = 0;
HMUSIC *mods = NULL;
int modc = 0;
HSAMPLE *sams = NULL;
int samc = 0;
// display error messages
void Error(const char *es)
{
char mes[200];
sprintf(mes, "%s\n(error code: %d)", es, BASS_ErrorGetCode());
MessageBox(win, mes, 0, 0);
}
// messaging macros
#define MESS(id,m,w,l) SendDlgItemMessage(win,id,m,(WPARAM)(w),(LPARAM)(l))
#define STLM(m,w,l) MESS(10,m,w,l)
#define MLM(m,w,l) MESS(20,m,w,l)
#define SLM(m,w,l) MESS(30,m,w,l)
#define GETSTR() STLM(LB_GETCURSEL,0,0)
#define GETMOD() MLM(LB_GETCURSEL,0,0)
#define GETSAM() SLM(LB_GETCURSEL,0,0)
INT_PTR CALLBACK dialogproc(HWND h, UINT m, WPARAM w, LPARAM l)
{
static OPENFILENAME ofn;
switch (m) {
case WM_TIMER:
{
// update the CPU usage display
char text[10];
sprintf(text, "%.2f", BASS_GetCPU());
MESS(40, WM_SETTEXT, 0, text);
// update volume slider in case it's been changed outside of the app
MESS(43, TBM_SETPOS, 1, BASS_GetVolume() * 100);
}
break;
case WM_COMMAND:
switch (LOWORD(w)) {
case IDCANCEL:
EndDialog(h, 0);
break;
case 14:
{
char file[MAX_PATH] = "";
HSTREAM str;
ofn.lpstrFilter = "Streamable files (wav/aif/mp3/mp2/mp1/ogg)\0*.wav;*.aif;*.mp3;*.mp2;*.mp1;*.ogg\0All files\0*.*\0\0";
ofn.lpstrFile = file;
if (GetOpenFileName(&ofn)) {
if (str = BASS_StreamCreateFile(FALSE, file, 0, 0, 0)) {
strc++;
strs = (HSTREAM*)realloc((void*)strs, strc * sizeof(*strs));
strs[strc - 1] = str;
STLM(LB_ADDSTRING, 0, strrchr(file, '\\') + 1);
} else
Error("Can't open stream");
}
}
break;
case 15:
{
int s = GETSTR();
if (s != LB_ERR) {
STLM(LB_DELETESTRING, s, 0);
BASS_StreamFree(strs[s]); // free the stream
strc--;
memcpy(strs + s, strs + s + 1, (strc - s) * sizeof(*strs));
}
}
break;
case 11:
{
int s = GETSTR();
if (s != LB_ERR)
if (!BASS_ChannelPlay(strs[s], FALSE)) // play the stream (continue from current position)
Error("Can't play stream");
}
break;
case 12:
{
int s = GETSTR();
if (s != LB_ERR) BASS_ChannelStop(strs[s]); // stop the stream
}
break;
case 13:
{
int s = GETSTR();
if (s != LB_ERR) BASS_ChannelPlay(strs[s], TRUE); // play the stream from the start
}
break;
case 24:
{
char file[MAX_PATH] = "";
HMUSIC mod;
ofn.lpstrFilter = "MOD music files (mo3/xm/mod/s3m/it/mtm/umx)\0*.mo3;*.xm;*.mod;*.s3m;*.it;*.mtm;*.umx\0All files\0*.*\0\0";
ofn.lpstrFile = file;
if (GetOpenFileName(&ofn)) {
// load a music from "file" with ramping enabled
if (mod = BASS_MusicLoad(FALSE, file, 0, 0, BASS_MUSIC_RAMPS, 1)) {
modc++;
mods = (HMUSIC*)realloc((void*)mods, modc * sizeof(*mods));
mods[modc - 1] = mod;
MLM(LB_ADDSTRING, 0, strrchr(file, '\\') + 1);
} else
Error("Can't load music");
}
}
break;
case 25:
{
int s = GETMOD();
if (s != LB_ERR) {
MLM(LB_DELETESTRING, s, 0);
BASS_MusicFree(mods[s]); // free the music
modc--;
memcpy(mods + s, mods + s + 1, (modc - s) * sizeof(*mods));
}
}
break;
case 21:
{
int s = GETMOD();
if (s != LB_ERR)
if (!BASS_ChannelPlay(mods[s], FALSE)) // play the music (continue from current position)
Error("Can't play music");
}
break;
case 22:
{
int s = GETMOD();
if (s != LB_ERR) BASS_ChannelStop(mods[s]); // stop the music
}
break;
case 23:
{
int s = GETMOD();
if (s != LB_ERR) BASS_ChannelPlay(mods[s], TRUE); // play the music from the start
}
break;
case 32:
{
char file[MAX_PATH] = "";
HSAMPLE sam;
ofn.lpstrFilter = "Sample files (wav/aif)\0*.wav;*.aif\0All files\0*.*\0\0";
ofn.lpstrFile = file;
if (GetOpenFileName(&ofn)) {
/* Load a sample from "file" and give it a max of 3 simultaneous
playings using playback position as override decider */
if (sam = BASS_SampleLoad(FALSE, file, 0, 0, 3, BASS_SAMPLE_OVER_POS)) {
samc++;
sams = (HSAMPLE*)realloc((void*)sams, samc * sizeof(*sams));
sams[samc - 1] = sam;
SLM(LB_ADDSTRING, 0, strrchr(file, '\\') + 1);
} else
Error("Can't load sample");
}
}
break;
case 33:
{
int s = GETSAM();
if (s != LB_ERR) {
SLM(LB_DELETESTRING, s, 0);
BASS_SampleFree(sams[s]); // free the sample
samc--;
memcpy(sams + s, sams + s + 1, (samc - s) * sizeof(*sams));
}
}
break;
case 31:
{
int s = GETSAM();
if (s != LB_ERR) {
// play the sample (at default rate, volume=50%, random pan position)
HCHANNEL ch = BASS_SampleGetChannel(sams[s], FALSE);
BASS_ChannelSetAttribute(ch, BASS_ATTRIB_VOL, 0.5f);
BASS_ChannelSetAttribute(ch, BASS_ATTRIB_PAN, ((rand() % 201) - 100) / 100.f);
if (!BASS_ChannelPlay(ch, FALSE))
Error("Can't play sample");
}
}
break;
case 41:
BASS_Pause(); // pause output
break;
case 42:
BASS_Start(); // resume output
break;
case 44:
BASS_SetConfig(BASS_CONFIG_UPDATETHREADS, MESS(44, BM_GETCHECK, 0, 0) ? 2 : 1); // set 1 or 2 update threads
break;
}
break;
case WM_HSCROLL:
if (l && LOWORD(w) != SB_THUMBPOSITION && LOWORD(w) != SB_ENDSCROLL) {
int p = SendMessage((HWND)l, TBM_GETPOS, 0, 0);
switch (GetDlgCtrlID((HWND)l)) {
case 16:
BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, p * 100); // global stream volume (0-10000)
break;
case 26:
BASS_SetConfig(BASS_CONFIG_GVOL_MUSIC, p * 100); // global MOD volume (0-10000)
break;
case 34:
BASS_SetConfig(BASS_CONFIG_GVOL_SAMPLE, p * 100); // global sample volume (0-10000)
break;
case 43:
BASS_SetVolume(p / 100.f); // output volume (0-1)
break;
}
}
break;
case WM_INITDIALOG:
win = h;
// initialize default output device
if (!BASS_Init(-1, 44100, 0, win, NULL)) {
Error("Can't initialize device");
EndDialog(win, 0);
return 0;
}
// initialize volume sliders
MESS(16, TBM_SETRANGE, 1, MAKELONG(0, 100));
MESS(16, TBM_SETPOS, 1, 100);
MESS(26, TBM_SETRANGE, 1, MAKELONG(0, 100));
MESS(26, TBM_SETPOS, 1, 100);
MESS(34, TBM_SETRANGE, 1, MAKELONG(0, 100));
MESS(34, TBM_SETPOS, 1, 100);
MESS(43, TBM_SETRANGE, 1, MAKELONG(0, 100));
MESS(43, TBM_SETPOS, 1, BASS_GetVolume() * 100);
SetTimer(h, 1, 500, NULL);
memset(&ofn, 0, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = h;
ofn.nMaxFile = MAX_PATH;
ofn.Flags = OFN_HIDEREADONLY | OFN_EXPLORER;
return 1;
case WM_DESTROY:
KillTimer(h, 1);
BASS_Free(); // close output
break;
}
return 0;
}
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
// check the correct BASS was loaded
if (HIWORD(BASS_GetVersion()) != BASSVERSION) {
MessageBox(0, "An incorrect version of BASS.DLL was loaded", 0, MB_ICONERROR);
return 0;
}
// enable "Default" device that follows default device changes
BASS_SetConfig(BASS_CONFIG_DEV_DEFAULT, 1);
// display the window
DialogBox(hInstance, MAKEINTRESOURCE(1000), NULL, dialogproc);
return 0;
}

View file

@ -0,0 +1,57 @@
# Microsoft Developer Studio Project File - Name="basstest" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=basstest - Win32 Release
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "basstest.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "basstest.mak" CFG="basstest - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "basstest - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "../bin"
# PROP BASE Intermediate_Dir "Release"
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "../bin"
# PROP Intermediate_Dir "Release"
# ADD BASE CPP /nologo /MD /GX /I ".." /D "WIN32" /D "NDEBUG" /FD /c
# ADD CPP /nologo /MD /GX /I ".." /D "WIN32" /D "NDEBUG" /FD /c
BSC32=bscmake.exe
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib comdlg32.lib /nologo /subsystem:windows /pdb:none /machine:I386
# ADD LINK32 kernel32.lib user32.lib comdlg32.lib /nologo /subsystem:windows /pdb:none /machine:I386
# Begin Target
# Name "basstest - Win32 Release"
# Begin Source File
SOURCE=basstest.c
# End Source File
# Begin Source File
SOURCE=basstest.rc
# End Source File
# Begin Source File
SOURCE=..\bass.lib
# End Source File
# End Target
# End Project

View file

@ -0,0 +1,48 @@
#include "windows.h"
1000 DIALOG DISCARDABLE 100, 100, 350, 130
STYLE WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "BASS - simple playback test"
FONT 8, "MS Sans Serif"
BEGIN
GROUPBOX "Stream",-1,5,0,110,107
LISTBOX 10,10,10,100,35,LBS_NOINTEGRALHEIGHT | WS_VSCROLL |
WS_TABSTOP
PUSHBUTTON "Play",11,10,50,30,12
PUSHBUTTON "Stop",12,45,50,30,12
PUSHBUTTON "Restart",13,80,50,30,12
PUSHBUTTON "Add ...",14,10,65,48,16
PUSHBUTTON "Remove",15,62,65,48,16
LTEXT "global volume:",-1,10,83,46,8
CONTROL "Slider1",16,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS |
WS_TABSTOP,10,92,100,11
GROUPBOX "MOD Music",-1,120,0,110,107
LISTBOX 20,125,10,100,35,LBS_NOINTEGRALHEIGHT | WS_VSCROLL |
WS_TABSTOP
PUSHBUTTON "Play",21,125,50,30,12
PUSHBUTTON "Stop",22,160,50,30,12
PUSHBUTTON "Restart",23,195,50,30,12
PUSHBUTTON "Add ...",24,125,65,48,16
PUSHBUTTON "Remove",25,177,65,48,16
LTEXT "global volume:",-1,125,83,46,8
CONTROL "Slider1",26,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS |
WS_TABSTOP,125,92,100,11
GROUPBOX "Sample",-1,235,0,110,107
LISTBOX 30,240,10,100,35,LBS_NOINTEGRALHEIGHT | WS_VSCROLL |
WS_TABSTOP
PUSHBUTTON "Play",31,240,50,100,12
PUSHBUTTON "Add ...",32,240,65,48,16
PUSHBUTTON "Remove",33,292,65,48,16
LTEXT "global volume:",-1,240,83,46,8
CONTROL "Slider1",34,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS |
WS_TABSTOP,240,92,100,11
PUSHBUTTON "Stop Output",41,20,112,60,14
PUSHBUTTON "Resume",42,85,112,60,14
LTEXT "volume:",-1,160,109,26,8
CONTROL "Slider1",43,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS |
WS_TABSTOP,160,118,100,11
LTEXT "CPU%",-1,291,120,25,8
LTEXT "",40,316,120,30,8
CONTROL "2 update threads",44,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,272,109,69,10
END

View file

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="basstest"
ProjectGUID="{DEE82226-C3D7-4C31-A234-8934FC43EF82}"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory="..\bin"
ConfigurationType="1"
CharacterSet="0"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".."
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="2"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="bass.lib"
AdditionalLibraryDirectories=".."
SubSystem="2"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="..\bin\x64"
ConfigurationType="1"
CharacterSet="0"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".."
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="2"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="bass.lib"
AdditionalLibraryDirectories="..\x64"
SubSystem="2"
TargetMachine="17"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath="basstest.c"
>
</File>
<File
RelativePath="basstest.rc"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{DEE82226-C3D7-4C31-A234-8934FC43EF82}</ProjectGuid>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>..\bin\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>..\bin\x64\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<AdditionalDependencies>bass.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<SubSystem>Windows</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<AdditionalDependencies>bass.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="basstest.c" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="basstest.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View file

@ -0,0 +1,10 @@
include ..\makefile.in
TARGET = basstest.exe
FLAGS += -mwindows
LIBS += -lcomdlg32
all: $(TARGET)
clean:
$(RM) $(OUTDIR)\$(TARGET)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,163 @@
/*
BASS simple console player
Copyright (c) 1999-2019 Un4seen Developments Ltd.
*/
#include <stdlib.h>
#include <stdio.h>
#include "bass.h"
#ifdef _WIN32 // Windows
#include <conio.h>
#else // OSX/Linux
#include <sys/time.h>
#include <termios.h>
#include <string.h>
#include <unistd.h>
#define Sleep(x) usleep(x*1000)
int _kbhit()
{
int r;
fd_set rfds;
struct timeval tv = { 0 };
struct termios term, oterm;
tcgetattr(0, &oterm);
memcpy(&term, &oterm, sizeof(term));
cfmakeraw(&term);
tcsetattr(0, TCSANOW, &term);
FD_ZERO(&rfds);
FD_SET(0, &rfds);
r = select(1, &rfds, NULL, NULL, &tv);
tcsetattr(0, TCSANOW, &oterm);
return r;
}
#endif
// display error messages
void Error(const char *text)
{
printf("Error(%d): %s\n", BASS_ErrorGetCode(), text);
BASS_Free();
exit(0);
}
void ListDevices()
{
BASS_DEVICEINFO di;
int a;
for (a = 0; BASS_GetDeviceInfo(a, &di); a++) {
if (di.flags & BASS_DEVICE_ENABLED) // enabled output device
printf("dev %d: %s\n", a, di.name);
}
}
void main(int argc, char **argv)
{
DWORD chan, act, time, level;
BOOL ismod;
QWORD pos;
int a, filep, device = -1;
printf("BASS simple console player\n"
"--------------------------\n");
// check the correct BASS was loaded
if (HIWORD(BASS_GetVersion()) != BASSVERSION) {
printf("An incorrect version of BASS was loaded");
return;
}
for (filep = 1; filep < argc; filep++) {
if (!strcmp(argv[filep], "-l")) {
ListDevices();
return;
} else if (!strcmp(argv[filep], "-d") && filep + 1 < argc) device = atoi(argv[++filep]);
else break;
}
if (filep == argc) {
printf("\tusage: contest [-l] [-d #] <file>\n"
"\t-l = list devices\n"
"\t-d = device number\n");
return;
}
BASS_SetConfig(BASS_CONFIG_NET_PLAYLIST, 1); // enable playlist processing
BASS_SetConfig(BASS_CONFIG_NET_PREBUF_WAIT, 0); // disable BASS_StreamCreateURL pre-buffering
// initialize output device
if (!BASS_Init(device, 44100, 0, 0, NULL))
Error("Can't initialize device");
// try streaming the file/url
if ((chan = BASS_StreamCreateFile(FALSE, argv[filep], 0, 0, BASS_SAMPLE_LOOP))
|| (chan = BASS_StreamCreateURL(argv[filep], 0, BASS_SAMPLE_LOOP, 0, 0))) {
pos = BASS_ChannelGetLength(chan, BASS_POS_BYTE);
if (BASS_StreamGetFilePosition(chan, BASS_FILEPOS_DOWNLOAD) != -1) {
// streaming from the internet
if (pos != -1)
printf("streaming internet file [%lld bytes]", pos);
else
printf("streaming internet file");
} else
printf("streaming file [%lld bytes]", pos);
ismod = FALSE;
} else {
// try loading the MOD (with looping, sensitive ramping, and calculate the duration)
if (!(chan = BASS_MusicLoad(FALSE, argv[filep], 0, 0, BASS_SAMPLE_LOOP | BASS_MUSIC_RAMPS | BASS_MUSIC_PRESCAN, 1)))
// not a MOD either
Error("Can't play the file");
{ // count channels
float dummy;
for (a = 0; BASS_ChannelGetAttribute(chan, BASS_ATTRIB_MUSIC_VOL_CHAN + a, &dummy); a++);
}
printf("playing MOD music \"%s\" [%u chans, %u orders]",
BASS_ChannelGetTags(chan, BASS_TAG_MUSIC_NAME), a, (DWORD)BASS_ChannelGetLength(chan, BASS_POS_MUSIC_ORDER));
pos = BASS_ChannelGetLength(chan, BASS_POS_BYTE);
ismod = TRUE;
}
// display the time length
if (pos != -1) {
time = (DWORD)BASS_ChannelBytes2Seconds(chan, pos);
printf(" %u:%02u\n", time / 60, time % 60);
} else // no time length available
printf("\n");
BASS_ChannelPlay(chan, FALSE);
while (!_kbhit() && (act = BASS_ChannelIsActive(chan))) {
// display some stuff and wait a bit
level = BASS_ChannelGetLevel(chan);
pos = BASS_ChannelGetPosition(chan, BASS_POS_BYTE);
time = BASS_ChannelBytes2Seconds(chan, pos);
printf("pos %09llu", pos);
if (ismod) {
pos = BASS_ChannelGetPosition(chan, BASS_POS_MUSIC_ORDER);
printf(" (%03u:%03u)", LOWORD(pos), HIWORD(pos));
}
printf(" - %u:%02u - L ", time / 60, time % 60);
if (act == BASS_ACTIVE_STALLED) { // playback has stalled
printf("- buffering: %3u%% -", 100 - (DWORD)BASS_StreamGetFilePosition(chan, BASS_FILEPOS_BUFFERING));
} else {
for (a = 27204; a > 200; a = a * 2 / 3) putchar(LOWORD(level) >= a ? '*' : '-');
putchar(' ');
for (a = 210; a < 32768; a = a * 3 / 2) putchar(HIWORD(level) >= a ? '*' : '-');
}
printf(" R - cpu %.2f%% \r", BASS_GetCPU());
fflush(stdout);
Sleep(50);
}
printf(" \r");
// wind the frequency down...
BASS_ChannelSlideAttribute(chan, BASS_ATTRIB_FREQ, 1000, 500);
Sleep(400);
// ...and fade-out to avoid a "click"
BASS_ChannelSlideAttribute(chan, BASS_ATTRIB_VOL | BASS_SLIDE_LOG, -1, 100);
// wait for slide to finish (could use BASS_SYNC_SLIDE instead)
while (BASS_ChannelIsSliding(chan, 0)) Sleep(1);
BASS_Free();
}

View file

@ -0,0 +1,53 @@
# Microsoft Developer Studio Project File - Name="contest" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=contest - Win32 Release
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "contest.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "contest.mak" CFG="contest - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "contest - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "../bin"
# PROP BASE Intermediate_Dir "Release"
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "../bin"
# PROP Intermediate_Dir "Release"
# ADD BASE CPP /nologo /MD /GX /I ".." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /FD /c
# ADD CPP /nologo /MD /GX /I ".." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /FD /c
BSC32=bscmake.exe
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib /nologo /subsystem:console /pdb:none /machine:I386
# ADD LINK32 kernel32.lib user32.lib /nologo /subsystem:console /pdb:none /machine:I386
# Begin Target
# Name "contest - Win32 Release"
# Begin Source File
SOURCE=contest.c
# End Source File
# Begin Source File
SOURCE=..\bass.lib
# End Source File
# End Target
# End Project

View file

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="contest"
ProjectGUID="{1151BD42-BAB0-4C67-A3CA-D23457250C41}"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory="..\bin"
ConfigurationType="1"
CharacterSet="0"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".."
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="bass.lib"
AdditionalLibraryDirectories=".."
SubSystem="1"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="..\bin\x64"
ConfigurationType="1"
CharacterSet="0"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".."
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="bass.lib"
AdditionalLibraryDirectories="..\x64"
SubSystem="1"
TargetMachine="17"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath="contest.c"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{1151BD42-BAB0-4C67-A3CA-D23457250C41}</ProjectGuid>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>..\bin\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>..\bin\x64\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<AdditionalDependencies>bass.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<AdditionalDependencies>bass.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="contest.c" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View file

@ -0,0 +1,8 @@
include ..\makefile.in
TARGET = contest.exe
all: $(TARGET)
clean:
$(RM) $(OUTDIR)\$(TARGET)

View file

@ -0,0 +1,267 @@
/*
BASS custom looping example
Copyright (c) 2004-2014 Un4seen Developments Ltd.
*/
#include <windows.h>
#include <stdio.h>
#include <process.h>
#include "bass.h"
#define WIDTH 600 // display width
#define HEIGHT 201 // height (odd number for centre line)
HWND win = NULL;
DWORD scanthread = 0;
BOOL killscan = FALSE;
DWORD chan;
DWORD bpp; // bytes per pixel
QWORD loop[2] = { 0 }; // loop start & end
HSYNC lsync; // looping sync
HDC wavedc = 0;
HBITMAP wavebmp = 0;
BYTE *wavebuf;
// display error messages
void Error(const char *es)
{
char mes[200];
sprintf(mes, "%s\n(error code: %d)", es, BASS_ErrorGetCode());
MessageBox(win, mes, 0, 0);
}
void CALLBACK LoopSyncProc(HSYNC handle, DWORD channel, DWORD data, void *user)
{
if (!BASS_ChannelSetPosition(channel, loop[0], BASS_POS_BYTE)) // try seeking to loop start
BASS_ChannelSetPosition(channel, 0, BASS_POS_BYTE); // failed, go to start of file instead
}
void SetLoopStart(QWORD pos)
{
loop[0] = pos;
}
void SetLoopEnd(QWORD pos)
{
loop[1] = pos;
BASS_ChannelRemoveSync(chan, lsync); // remove old sync
lsync = BASS_ChannelSetSync(chan, BASS_SYNC_POS | BASS_SYNC_MIXTIME, loop[1], LoopSyncProc, 0); // set new sync
}
// scan the peaks
void __cdecl ScanPeaks(void *p)
{
DWORD decoder = (DWORD)p;
DWORD pos = 0;
float spp = BASS_ChannelBytes2Seconds(decoder, bpp); // seconds per pixel
while (!killscan) {
float peak[2];
if (spp > 1) { // more than 1 second per pixel, break it down...
float todo = spp;
peak[1] = peak[0] = 0;
do {
float level[2], step = (todo < 1 ? todo : 1);
BASS_ChannelGetLevelEx(decoder, level, step, BASS_LEVEL_STEREO); // scan peaks
if (peak[0] < level[0]) peak[0] = level[0];
if (peak[1] < level[1]) peak[1] = level[1];
todo -= step;
} while (todo > 0);
} else
BASS_ChannelGetLevelEx(decoder, peak, spp, BASS_LEVEL_STEREO); // scan peaks
{
DWORD a;
for (a = 0; a < peak[0] * (HEIGHT / 2); a++)
wavebuf[(HEIGHT / 2 - 1 - a) * WIDTH + pos] = 1 + a; // draw left peak
for (a = 0; a < peak[1] * (HEIGHT / 2); a++)
wavebuf[(HEIGHT / 2 + 1 + a) * WIDTH + pos] = 1 + a; // draw right peak
}
pos++;
if (pos >= WIDTH) break; // reached end of display
if (!BASS_ChannelIsActive(decoder)) break; // reached end of channel
}
if (!killscan) {
DWORD size;
BASS_ChannelSetPosition(decoder, (QWORD)-1, BASS_POS_BYTE | BASS_POS_SCAN); // build seek table (scan to end)
size = BASS_ChannelGetAttributeEx(decoder, BASS_ATTRIB_SCANINFO, 0, 0); // get seek table size
if (size) { // got it
void *info = malloc(size); // allocate a buffer
BASS_ChannelGetAttributeEx(decoder, BASS_ATTRIB_SCANINFO, info, size); // get the seek table
BASS_ChannelSetAttributeEx(chan, BASS_ATTRIB_SCANINFO, info, size); // apply it to the playback channel
free(info);
}
}
BASS_StreamFree(decoder); // free the decoder
scanthread = 0;
}
// select a file to play, and start scanning it
BOOL PlayFile()
{
char file[MAX_PATH] = "";
OPENFILENAME ofn = { 0 };
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = win;
ofn.nMaxFile = MAX_PATH;
ofn.lpstrFile = file;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_EXPLORER;
ofn.lpstrTitle = "Select a file to play";
ofn.lpstrFilter = "Playable files\0*.mp3;*.mp2;*.mp1;*.ogg;*.wav;*.aif;*.mo3;*.it;*.xm;*.s3m;*.mtm;*.mod;*.umx\0All files\0*.*\0\0";
if (!GetOpenFileName(&ofn)) return FALSE;
if (!(chan = BASS_StreamCreateFile(FALSE, file, 0, 0, 0))
&& !(chan = BASS_MusicLoad(FALSE, file, 0, 0, BASS_MUSIC_RAMPS | BASS_MUSIC_POSRESET | BASS_MUSIC_PRESCAN, 1))) {
Error("Can't play file");
return FALSE; // Can't load the file
}
{
BYTE data[2000] = { 0 };
BITMAPINFOHEADER *bh = (BITMAPINFOHEADER*)data;
RGBQUAD *pal = (RGBQUAD*)(data + sizeof(*bh));
int a;
bh->biSize = sizeof(*bh);
bh->biWidth = WIDTH;
bh->biHeight = -HEIGHT;
bh->biPlanes = 1;
bh->biBitCount = 8;
bh->biClrUsed = bh->biClrImportant = HEIGHT / 2 + 1;
// setup palette
for (a = 1; a <= HEIGHT / 2; a++) {
pal[a].rgbRed = (255 * a) / (HEIGHT / 2);
pal[a].rgbGreen = 255 - pal[a].rgbRed;
}
// create the bitmap
wavebmp = CreateDIBSection(0, (BITMAPINFO*)bh, DIB_RGB_COLORS, (void**)&wavebuf, NULL, 0);
wavedc = CreateCompatibleDC(0);
SelectObject(wavedc, wavebmp);
}
bpp = BASS_ChannelGetLength(chan, BASS_POS_BYTE) / WIDTH; // bytes per pixel
{
DWORD bpp1 = BASS_ChannelSeconds2Bytes(chan, 0.001); // minimum 1ms per pixel
if (bpp < bpp1) bpp = bpp1;
}
BASS_ChannelSetSync(chan, BASS_SYNC_END | BASS_SYNC_MIXTIME, 0, LoopSyncProc, 0); // set sync to loop at end
BASS_ChannelPlay(chan, FALSE); // start playing
{ // create another channel to scan
DWORD chan2 = BASS_StreamCreateFile(FALSE, file, 0, 0, BASS_STREAM_DECODE);
if (!chan2) chan2 = BASS_MusicLoad(FALSE, file, 0, 0, BASS_MUSIC_DECODE, 1);
scanthread = _beginthread(ScanPeaks, 0, (void*)chan2); // start scanning in a new thread
}
return TRUE;
}
void DrawTimeLine(HDC dc, QWORD pos, DWORD col, DWORD y)
{
HPEN pen = CreatePen(PS_SOLID, 0, col), oldpen;
DWORD wpos = pos / bpp;
DWORD time = BASS_ChannelBytes2Seconds(chan, pos) * 1000; // position in milliseconds
char text[16];
sprintf(text, "%u:%02u.%03u", time / 60000, (time / 1000) % 60, time % 1000);
oldpen = (HPEN)SelectObject(dc, pen);
MoveToEx(dc, wpos, 0, NULL);
LineTo(dc, wpos, HEIGHT);
SetTextColor(dc, col);
SetBkMode(dc, TRANSPARENT);
SetTextAlign(dc, wpos >= WIDTH / 2 ? TA_RIGHT : TA_LEFT);
TextOut(dc, wpos, y, text, strlen(text));
SelectObject(dc, oldpen);
DeleteObject(pen);
}
// 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);
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
WNDCLASS wc;
MSG msg;
// check the correct BASS was loaded
if (HIWORD(BASS_GetVersion()) != BASSVERSION) {
MessageBox(0, "An incorrect version of BASS.DLL was loaded", 0, MB_ICONERROR);
return 0;
}
// register window class and create the window
memset(&wc, 0, sizeof(wc));
wc.lpfnWndProc = SpectrumWindowProc;
wc.hInstance = hInstance;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.lpszClassName = "BASS-CustLoop";
if (!RegisterClass(&wc) || !CreateWindow("BASS-CustLoop",
"BASS custom looping example (left-click to set loop start, right-click to set end)",
WS_POPUPWINDOW | WS_CAPTION | WS_VISIBLE, 100, 100,
WIDTH + 2 * GetSystemMetrics(SM_CXDLGFRAME),
HEIGHT + GetSystemMetrics(SM_CYCAPTION) + 2 * GetSystemMetrics(SM_CYDLGFRAME),
NULL, NULL, hInstance, NULL)) {
Error("Can't create window");
return 0;
}
ShowWindow(win, SW_SHOWNORMAL);
while (GetMessage(&msg, NULL, 0, 0) > 0) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}

View file

@ -0,0 +1,53 @@
# Microsoft Developer Studio Project File - Name="custloop" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=custloop - Win32 Release
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "custloop.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "custloop.mak" CFG="custloop - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "custloop - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "../bin"
# PROP BASE Intermediate_Dir "Release"
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "../bin"
# PROP Intermediate_Dir "Release"
# ADD BASE CPP /nologo /MD /GX /I ".." /D "WIN32" /D "NDEBUG" /FD /c
# ADD CPP /nologo /MD /GX /I ".." /D "WIN32" /D "NDEBUG" /FD /c
BSC32=bscmake.exe
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib comdlg32.lib gdi32.lib /nologo /subsystem:windows /pdb:none /machine:I386
# ADD LINK32 kernel32.lib user32.lib comdlg32.lib gdi32.lib /nologo /subsystem:windows /pdb:none /machine:I386
# Begin Target
# Name "custloop - Win32 Release"
# Begin Source File
SOURCE=custloop.c
# End Source File
# Begin Source File
SOURCE=..\bass.lib
# End Source File
# End Target
# End Project

View file

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="custloop"
ProjectGUID="{BC8FF451-F01D-404B-B39A-D7C59A567D95}"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory="..\bin"
ConfigurationType="1"
CharacterSet="0"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".."
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="2"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="bass.lib"
AdditionalLibraryDirectories=".."
SubSystem="2"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="..\bin\x64"
ConfigurationType="1"
CharacterSet="0"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".."
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="2"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="bass.lib"
AdditionalLibraryDirectories="..\x64"
SubSystem="2"
TargetMachine="17"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath="custloop.c"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{BC8FF451-F01D-404B-B39A-D7C59A567D95}</ProjectGuid>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>..\bin\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>..\bin\x64\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<AdditionalDependencies>bass.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<SubSystem>Windows</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<AdditionalDependencies>bass.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="custloop.c" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View file

@ -0,0 +1,10 @@
include ..\makefile.in
TARGET = custloop.exe
FLAGS += -mwindows
LIBS += -lcomdlg32 -lgdi32
all: $(TARGET)
clean:
$(RM) $(OUTDIR)\$(TARGET)

View file

@ -0,0 +1,76 @@
/*
BASS device list example
Copyright (c) 2014-2019 Un4seen Developments Ltd.
*/
#include <stdio.h>
#include "bass.h"
void DisplayDeviceInfo(BASS_DEVICEINFO *di)
{
#if 0//def _WIN32
const char *path = di->driver + strlen(di->driver) + 1;
if (path[0])
printf("%s\n\tdriver: %s\n\tpath: %s\n\ttype: ", di->name, di->driver, path);
else
#endif
printf("%s\n\tdriver: %s\n\ttype: ", di->name, di->driver);
switch (di->flags & BASS_DEVICE_TYPE_MASK) {
case BASS_DEVICE_TYPE_NETWORK:
printf("Remote Network");
break;
case BASS_DEVICE_TYPE_SPEAKERS:
printf("Speakers");
break;
case BASS_DEVICE_TYPE_LINE:
printf("Line");
break;
case BASS_DEVICE_TYPE_HEADPHONES:
printf("Headphones");
break;
case BASS_DEVICE_TYPE_MICROPHONE:
printf("Microphone");
break;
case BASS_DEVICE_TYPE_HEADSET:
printf("Headset");
break;
case BASS_DEVICE_TYPE_HANDSET:
printf("Handset");
break;
case BASS_DEVICE_TYPE_DIGITAL:
printf("Digital");
break;
case BASS_DEVICE_TYPE_SPDIF:
printf("SPDIF");
break;
case BASS_DEVICE_TYPE_HDMI:
printf("HDMI");
break;
case BASS_DEVICE_TYPE_DISPLAYPORT:
printf("DisplayPort");
break;
default:
printf("Unknown");
}
printf("\n\tflags:");
if (di->flags & BASS_DEVICE_LOOPBACK) printf(" loopback");
if (di->flags & BASS_DEVICE_ENABLED) printf(" enabled");
if (di->flags & BASS_DEVICE_DEFAULT) printf(" default");
printf(" (%x)\n", di->flags);
}
void main()
{
BASS_DEVICEINFO di;
int a;
printf("Output Devices\n");
for (a = 1; BASS_GetDeviceInfo(a, &di); a++) {
printf("%d: ", a);
DisplayDeviceInfo(&di);
}
printf("\nInput Devices\n");
for (a = 0; BASS_RecordGetDeviceInfo(a, &di); a++) {
printf("%d: ", a);
DisplayDeviceInfo(&di);
}
}

View file

@ -0,0 +1,53 @@
# Microsoft Developer Studio Project File - Name="devlist" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=devlist - Win32 Release
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "devlist.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "devlist.mak" CFG="devlist - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "devlist - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "../bin"
# PROP BASE Intermediate_Dir "Release"
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "../bin"
# PROP Intermediate_Dir "Release"
# ADD BASE CPP /nologo /MD /GX /I ".." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /FD /c
# ADD CPP /nologo /MD /GX /I ".." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /FD /c
BSC32=bscmake.exe
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib /nologo /subsystem:console /pdb:none /machine:I386
# ADD LINK32 kernel32.lib user32.lib /nologo /subsystem:console /pdb:none /machine:I386
# Begin Target
# Name "devlist - Win32 Release"
# Begin Source File
SOURCE=devlist.c
# End Source File
# Begin Source File
SOURCE=..\bass.lib
# End Source File
# End Target
# End Project

View file

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="devlist"
ProjectGUID="{1151BD42-BAB0-4C67-A3CA-D23457250C42}"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory="..\bin"
ConfigurationType="1"
CharacterSet="0"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".."
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="bass.lib"
AdditionalLibraryDirectories=".."
SubSystem="1"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="..\bin\x64"
ConfigurationType="1"
CharacterSet="0"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".."
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="bass.lib"
AdditionalLibraryDirectories="..\x64"
SubSystem="1"
TargetMachine="17"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath="devlist.c"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{1151BD42-BAB0-4C67-A3CA-D23457250C42}</ProjectGuid>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>..\bin\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>..\bin\x64\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<AdditionalDependencies>bass.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<AdditionalDependencies>bass.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="devlist.c" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View file

@ -0,0 +1,8 @@
include ..\makefile.in
TARGET = devlist.exe
all: $(TARGET)
clean:
$(RM) $(OUTDIR)\$(TARGET)

View file

@ -0,0 +1,223 @@
/*
BASS simple DSP test
Copyright (c) 2000-2012 Un4seen Developments Ltd.
*/
#include <windows.h>
#include <stdio.h>
#include <math.h>
#include "bass.h"
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
HWND win = NULL;
DWORD floatable; // floating-point channel support?
DWORD chan; // the channel... HMUSIC or HSTREAM
OPENFILENAME ofn;
// display error messages
void Error(const char *es)
{
char mes[200];
sprintf(mes, "%s\n(error code: %d)", es, BASS_ErrorGetCode());
MessageBox(win, mes, 0, 0);
}
// "rotate"
HDSP rotdsp = 0; // DSP handle
float rotpos; // cur.pos
void CALLBACK Rotate(HDSP handle, DWORD channel, void *buffer, DWORD length, void *user)
{
float *d = (float*)buffer;
DWORD a;
for (a = 0; a < length / 4; a += 2) {
d[a] *= fabs(sin(rotpos));
d[a + 1] *= fabs(cos(rotpos));
rotpos += 0.00003;
}
rotpos = fmod(rotpos, 2 * M_PI);
}
// "echo"
HDSP echdsp = 0; // DSP handle
#define ECHBUFLEN 1200 // buffer length
float echbuf[ECHBUFLEN][2]; // buffer
int echpos; // cur.pos
void CALLBACK Echo(HDSP handle, DWORD channel, void *buffer, DWORD length, void *user)
{
float *d = (float*)buffer;
DWORD a;
for (a = 0; a < length / 4; a += 2) {
float l = d[a] + (echbuf[echpos][1] / 2);
float r = d[a + 1] + (echbuf[echpos][0] / 2);
#if 1 // 0=echo, 1=basic "bathroom" reverb
echbuf[echpos][0] = d[a] = l;
echbuf[echpos][1] = d[a + 1] = r;
#else
echbuf[echpos][0] = d[a];
echbuf[echpos][1] = d[a + 1];
d[a] = l;
d[a + 1] = r;
#endif
echpos++;
if (echpos == ECHBUFLEN) echpos = 0;
}
}
// "flanger"
HDSP fladsp = 0; // DSP handle
#define FLABUFLEN 350 // buffer length
float flabuf[FLABUFLEN][2]; // buffer
int flapos; // cur.pos
float flas, flasinc; // sweep pos/increment
void CALLBACK Flange(HDSP handle, DWORD channel, void *buffer, DWORD length, void *user)
{
float *d = (float*)buffer;
DWORD a;
for (a = 0; a < length / 4; a += 2) {
int p1 = (flapos + (int)flas) % FLABUFLEN;
int p2 = (p1 + 1) % FLABUFLEN;
float f = flas - (int)flas;
float s;
s = (d[a] + ((flabuf[p1][0] * (1 - f)) + (flabuf[p2][0] * f))) * 0.7;
flabuf[flapos][0] = d[a];
d[a] = s;
s = (d[a + 1] + ((flabuf[p1][1] * (1 - f)) + (flabuf[p2][1] * f))) * 0.7;
flabuf[flapos][1] = d[a + 1];
d[a + 1] = s;
flapos++;
if (flapos == FLABUFLEN) flapos = 0;
flas += flasinc;
if (flas<0 || flas>FLABUFLEN - 1) {
flasinc = -flasinc;
flas += flasinc;
}
}
}
#define MESS(id,m,w,l) SendDlgItemMessage(win,id,m,(WPARAM)(w),(LPARAM)(l))
INT_PTR CALLBACK dialogproc(HWND h, UINT m, WPARAM w, LPARAM l)
{
switch (m) {
case WM_COMMAND:
switch (LOWORD(w)) {
case IDCANCEL:
EndDialog(h, 0);
break;
case 10:
{
BASS_CHANNELINFO info;
char file[MAX_PATH] = "";
ofn.lpstrFilter = "playable files\0*.mo3;*.xm;*.mod;*.s3m;*.it;*.mtm;*.umx;*.mp3;*.mp2;*.mp1;*.ogg;*.wav;*.aif\0All files\0*.*\0\0";
ofn.lpstrFile = file;
if (GetOpenFileName(&ofn)) {
// free both MOD and stream, it must be one of them! :)
BASS_MusicFree(chan);
BASS_StreamFree(chan);
if (!(chan = BASS_StreamCreateFile(FALSE, file, 0, 0, BASS_SAMPLE_LOOP | floatable))
&& !(chan = BASS_MusicLoad(FALSE, file, 0, 0, BASS_SAMPLE_LOOP | BASS_MUSIC_RAMPS | floatable, 1))) {
// whatever it is, it ain't playable
MESS(10, WM_SETTEXT, 0, "click here to open a file...");
Error("Can't play the file");
break;
}
BASS_ChannelGetInfo(chan, &info);
if (info.chans != 2) { // only stereo is allowed
MESS(10, WM_SETTEXT, 0, "click here to open a file...");
BASS_MusicFree(chan);
BASS_StreamFree(chan);
Error("only stereo sources are supported");
break;
}
MESS(10, WM_SETTEXT, 0, file);
// setup DSPs on new channel and play it
SendMessage(win, WM_COMMAND, 11, 0);
SendMessage(win, WM_COMMAND, 12, 0);
SendMessage(win, WM_COMMAND, 13, 0);
BASS_ChannelPlay(chan, FALSE);
}
}
break;
case 11: // toggle "rotate"
if (MESS(11, BM_GETCHECK, 0, 0)) {
rotpos = M_PI / 4;
rotdsp = BASS_ChannelSetDSP(chan, &Rotate, 0, 2);
} else
BASS_ChannelRemoveDSP(chan, rotdsp);
break;
case 12: // toggle "echo"
if (MESS(12, BM_GETCHECK, 0, 0)) {
memset(echbuf, 0, sizeof(echbuf));
echpos = 0;
echdsp = BASS_ChannelSetDSP(chan, &Echo, 0, 1);
} else
BASS_ChannelRemoveDSP(chan, echdsp);
break;
case 13: // toggle "flanger"
if (MESS(13, BM_GETCHECK, 0, 0)) {
memset(flabuf, 0, sizeof(flabuf));
flapos = 0;
flas = FLABUFLEN / 2;
flasinc = 0.002f;
fladsp = BASS_ChannelSetDSP(chan, &Flange, 0, 0);
} else
BASS_ChannelRemoveDSP(chan, fladsp);
break;
}
break;
case WM_INITDIALOG:
win = h;
memset(&ofn, 0, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = h;
ofn.nMaxFile = MAX_PATH;
ofn.Flags = OFN_HIDEREADONLY | OFN_EXPLORER;
// enable floating-point DSP
BASS_SetConfig(BASS_CONFIG_FLOATDSP, TRUE);
// initialize default output device
if (!BASS_Init(-1, 44100, 0, win, NULL)) {
Error("Can't initialize device");
EndDialog(h, 0);
break;
}
// check for floating-point capability
floatable = BASS_StreamCreate(44100, 2, BASS_SAMPLE_FLOAT, NULL, 0);
if (floatable) { // woohoo!
BASS_StreamFree(floatable);
floatable = BASS_SAMPLE_FLOAT;
}
return 1;
case WM_DESTROY:
BASS_Free();
break;
}
return 0;
}
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
// check the correct BASS was loaded
if (HIWORD(BASS_GetVersion()) != BASSVERSION) {
MessageBox(0, "An incorrect version of BASS.DLL was loaded", 0, MB_ICONERROR);
return 0;
}
DialogBox(hInstance, MAKEINTRESOURCE(1000), NULL, dialogproc);
return 0;
}

View file

@ -0,0 +1,57 @@
# Microsoft Developer Studio Project File - Name="dsptest" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=dsptest - Win32 Release
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "dsptest.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "dsptest.mak" CFG="dsptest - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "dsptest - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "../bin"
# PROP BASE Intermediate_Dir "Release"
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "../bin"
# PROP Intermediate_Dir "Release"
# ADD BASE CPP /nologo /MD /GX /I ".." /D "WIN32" /D "NDEBUG" /FD /c
# ADD CPP /nologo /MD /GX /I ".." /D "WIN32" /D "NDEBUG" /FD /c
BSC32=bscmake.exe
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib comdlg32.lib /nologo /subsystem:windows /pdb:none /machine:I386
# ADD LINK32 kernel32.lib user32.lib comdlg32.lib /nologo /subsystem:windows /pdb:none /machine:I386
# Begin Target
# Name "dsptest - Win32 Release"
# Begin Source File
SOURCE=dsptest.c
# End Source File
# Begin Source File
SOURCE=dsptest.rc
# End Source File
# Begin Source File
SOURCE=..\bass.lib
# End Source File
# End Target
# End Project

View file

@ -0,0 +1,15 @@
#include "windows.h"
1000 DIALOG DISCARDABLE 100, 100, 200, 49
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "BASS simple DSP test"
FONT 8, "MS Sans Serif"
BEGIN
PUSHBUTTON "click here to open a file...",10,5,5,190,14
CONTROL "rotate",11,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,40,30,
35,10
CONTROL "echo",12,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,80,30,35,
10
CONTROL "flanger",13,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,120,
30,35,10
END

View file

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="dsptest"
ProjectGUID="{89104783-85C4-4E31-9EDC-FAF7D6792BF0}"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory="..\bin"
ConfigurationType="1"
CharacterSet="0"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".."
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="2"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="bass.lib"
AdditionalLibraryDirectories=".."
SubSystem="2"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="..\bin\x64"
ConfigurationType="1"
CharacterSet="0"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".."
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="2"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="bass.lib"
AdditionalLibraryDirectories="..\x64"
SubSystem="2"
TargetMachine="17"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath="dsptest.c"
>
</File>
<File
RelativePath="dsptest.rc"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{89104783-85C4-4E31-9EDC-FAF7D6792BF0}</ProjectGuid>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>..\bin\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>..\bin\x64\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<AdditionalDependencies>bass.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<SubSystem>Windows</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<AdditionalDependencies>bass.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="dsptest.c" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="dsptest.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View file

@ -0,0 +1,10 @@
include ..\makefile.in
TARGET = dsptest.exe
FLAGS += -mwindows
LIBS += -lcomdlg32
all: $(TARGET)
clean:
$(RM) $(OUTDIR)\$(TARGET)

View file

@ -0,0 +1,198 @@
/*
BASS DX8 effects test
Copyright (c) 2001-2017 Un4seen Developments Ltd.
*/
#include <windows.h>
#include <commctrl.h>
#include <stdio.h>
#include <math.h>
#include "bass.h"
HWND win = NULL;
DWORD chan; // channel handle
DWORD fxchan = 0; // output stream handle
DWORD fxchansync; // output stream FREE sync
HFX fx[4]; // 3 eq bands + reverb
OPENFILENAME ofn;
// display error messages
void Error(const char *es)
{
char mes[200];
sprintf(mes, "%s\n(error code: %d)", es, BASS_ErrorGetCode());
MessageBox(win, mes, 0, 0);
}
#define MESS(id,m,w,l) SendDlgItemMessage(win,id,m,(WPARAM)(w),(LPARAM)(l))
void UpdateFX(int b)
{
int v = MESS(20 + b, TBM_GETPOS, 0, 0);
if (b < 3) {
BASS_DX8_PARAMEQ p;
BASS_FXGetParameters(fx[b], &p);
p.fGain = 10.0 - v;
BASS_FXSetParameters(fx[b], &p);
} else {
BASS_DX8_REVERB p;
BASS_FXGetParameters(fx[3], &p);
p.fReverbMix = (v < 20 ? log(1 - v / 20.0) * 20 : -96);
BASS_FXSetParameters(fx[3], &p);
}
}
void SetupFX()
{
// setup the effects
BASS_DX8_PARAMEQ p;
DWORD ch = fxchan ? fxchan : chan; // set on output stream if enabled, else file stream
fx[0] = BASS_ChannelSetFX(ch, BASS_FX_DX8_PARAMEQ, 0);
fx[1] = BASS_ChannelSetFX(ch, BASS_FX_DX8_PARAMEQ, 0);
fx[2] = BASS_ChannelSetFX(ch, BASS_FX_DX8_PARAMEQ, 0);
fx[3] = BASS_ChannelSetFX(ch, BASS_FX_DX8_REVERB, 0);
p.fGain = 0;
p.fBandwidth = 18;
p.fCenter = 125;
BASS_FXSetParameters(fx[0], &p);
p.fCenter = 1000;
BASS_FXSetParameters(fx[1], &p);
p.fCenter = 8000;
BASS_FXSetParameters(fx[2], &p);
UpdateFX(0);
UpdateFX(1);
UpdateFX(2);
UpdateFX(3);
}
void CALLBACK DeviceFreeSync(HSYNC handle, DWORD channel, DWORD data, void *user)
{
// the device output stream has been freed due to format change, get a new one with new format
if (!fxchan) return;
fxchan = BASS_StreamCreate(0, 0, 0, STREAMPROC_DEVICE, 0);
fxchansync = BASS_ChannelSetSync(fxchan, BASS_SYNC_FREE, 0, DeviceFreeSync, 0);
SetupFX();
}
INT_PTR CALLBACK dialogproc(HWND h, UINT m, WPARAM w, LPARAM l)
{
switch (m) {
case WM_COMMAND:
switch (LOWORD(w)) {
case IDCANCEL:
EndDialog(h, 0);
break;
case 10:
{
char file[MAX_PATH] = "";
ofn.lpstrFilter = "playable files\0*.mo3;*.xm;*.mod;*.s3m;*.it;*.mtm;*.umx;*.mp3;*.mp2;*.mp1;*.ogg;*.wav;*.aif\0All files\0*.*\0\0";
ofn.lpstrFile = file;
if (GetOpenFileName(&ofn)) {
// free both MOD and stream, it must be one of them! :)
BASS_MusicFree(chan);
BASS_StreamFree(chan);
if (!(chan = BASS_StreamCreateFile(FALSE, file, 0, 0, BASS_SAMPLE_LOOP | BASS_SAMPLE_FLOAT))
&& !(chan = BASS_MusicLoad(FALSE, file, 0, 0, BASS_SAMPLE_LOOP | BASS_MUSIC_RAMP | BASS_SAMPLE_FLOAT, 1))) {
// whatever it is, it ain't playable
MESS(10, WM_SETTEXT, 0, "click here to open a file...");
Error("Can't play the file");
break;
}
MESS(10, WM_SETTEXT, 0, file);
if (!fxchan) SetupFX(); // set effects on file if not using output stream
BASS_ChannelPlay(chan, FALSE);
}
}
break;
case 30:
{
// remove current effects
DWORD ch = fxchan ? fxchan : chan;
BASS_ChannelRemoveFX(ch, fx[0]);
BASS_ChannelRemoveFX(ch, fx[1]);
BASS_ChannelRemoveFX(ch, fx[2]);
BASS_ChannelRemoveFX(ch, fx[3]);
if (MESS(30, BM_GETCHECK, 0, 0)) {
fxchan = BASS_StreamCreate(0, 0, 0, STREAMPROC_DEVICE, 0); // get device output stream
fxchansync = BASS_ChannelSetSync(fxchan, BASS_SYNC_FREE, 0, DeviceFreeSync, 0); // sync when device output stream is freed (format change)
} else {
BASS_ChannelRemoveSync(fxchan, fxchansync); // remove sync from device output stream
fxchan = 0; // stop using device output stream
}
SetupFX();
}
break;
}
break;
case WM_VSCROLL:
if (l) {
UpdateFX(GetDlgCtrlID((HWND)l) - 20);
}
break;
case WM_INITDIALOG:
win = h;
memset(&ofn, 0, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = h;
ofn.nMaxFile = MAX_PATH;
ofn.Flags = OFN_HIDEREADONLY | OFN_EXPLORER;
// initialize default device
if (!BASS_Init(-1, 44100, 0, win, NULL)) {
Error("Can't initialize device");
EndDialog(win, 0);
return 0;
}
{
// check that DX8 features are available
BASS_INFO bi = { sizeof(bi) };
BASS_GetInfo(&bi);
if (bi.dsver < 8) {
BASS_Free();
Error("DirectX 8 is not installed");
EndDialog(win, 0);
return 0;
}
// disable output stream option if using DirectSound output
if (bi.initflags & BASS_DEVICE_DSOUND)
EnableWindow(GetDlgItem(win, 30), FALSE);
}
// initialize eq/reverb sliders
MESS(20, TBM_SETRANGE, FALSE, MAKELONG(0, 20));
MESS(20, TBM_SETPOS, TRUE, 10);
MESS(21, TBM_SETRANGE, FALSE, MAKELONG(0, 20));
MESS(21, TBM_SETPOS, TRUE, 10);
MESS(22, TBM_SETRANGE, FALSE, MAKELONG(0, 20));
MESS(22, TBM_SETPOS, TRUE, 10);
MESS(23, TBM_SETRANGE, FALSE, MAKELONG(0, 20));
MESS(23, TBM_SETPOS, TRUE, 20);
return 1;
case WM_DESTROY:
if (fxchan) BASS_ChannelRemoveSync(fxchan, fxchansync); // remove sync from device output stream
BASS_Free();
break;
}
return 0;
}
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
// check the correct BASS was loaded
if (HIWORD(BASS_GetVersion()) != BASSVERSION) {
MessageBox(0, "An incorrect version of BASS.DLL was loaded", 0, MB_ICONERROR);
return 0;
}
{ // enable trackbar support
INITCOMMONCONTROLSEX cc = { sizeof(cc),ICC_BAR_CLASSES };
InitCommonControlsEx(&cc);
}
DialogBox(hInstance, MAKEINTRESOURCE(1000), NULL, dialogproc);
return 0;
}

View file

@ -0,0 +1,57 @@
# Microsoft Developer Studio Project File - Name="fxtest" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=fxtest - Win32 Release
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "fxtest.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "fxtest.mak" CFG="fxtest - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "fxtest - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "../bin"
# PROP BASE Intermediate_Dir "Release"
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "../bin"
# PROP Intermediate_Dir "Release"
# ADD BASE CPP /nologo /MD /GX /I ".." /D "WIN32" /D "NDEBUG" /FD /c
# ADD CPP /nologo /MD /GX /I ".." /D "WIN32" /D "NDEBUG" /FD /c
BSC32=bscmake.exe
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib comdlg32.lib comctl32.lib /nologo /subsystem:windows /pdb:none /machine:I386
# ADD LINK32 kernel32.lib user32.lib comdlg32.lib comctl32.lib /nologo /subsystem:windows /pdb:none /machine:I386
# Begin Target
# Name "fxtest - Win32 Release"
# Begin Source File
SOURCE=fxtest.c
# End Source File
# Begin Source File
SOURCE=fxtest.rc
# End Source File
# Begin Source File
SOURCE=..\bass.lib
# End Source File
# End Target
# End Project

View file

@ -0,0 +1,23 @@
#include <windows.h>
1000 DIALOG DISCARDABLE 100, 100, 200, 100
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "BASS DX8 effects test"
FONT 8, "MS Sans Serif"
BEGIN
PUSHBUTTON "click here to open a file...",10,5,5,190,14
CONTROL "",20,"msctls_trackbar32",TBS_BOTH | TBS_VERT |
WS_TABSTOP,20,25,30,45
CONTROL "",21,"msctls_trackbar32",TBS_BOTH | TBS_VERT |
WS_TABSTOP,55,25,30,45
CONTROL "",22,"msctls_trackbar32",TBS_BOTH | TBS_VERT |
WS_TABSTOP,90,25,30,45
CONTROL "",23,"msctls_trackbar32",TBS_BOTH | TBS_VERT |
WS_TABSTOP,150,25,30,45
CTEXT "125 hz",-1,20,72,30,8
CTEXT "1 khz",-1,55,72,30,8
CTEXT "8 khz",-1,90,72,30,8
CTEXT "reverb",-1,150,72,30,8
CONTROL "Apply effects to final output instead of file",30,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,5,87,150,10
END

View file

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="fxtest"
ProjectGUID="{46119084-C4AA-4240-A2D6-A6AFC1A82106}"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory="..\bin"
ConfigurationType="1"
CharacterSet="0"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".."
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="2"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="bass.lib comctl32.lib"
AdditionalLibraryDirectories=".."
SubSystem="2"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="..\bin\x64"
ConfigurationType="1"
CharacterSet="0"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".."
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="2"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="bass.lib comctl32.lib"
AdditionalLibraryDirectories="..\x64"
SubSystem="2"
TargetMachine="17"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath="fxtest.c"
>
</File>
<File
RelativePath="fxtest.rc"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{46119084-C4AA-4240-A2D6-A6AFC1A82106}</ProjectGuid>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>..\bin\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>..\bin\x64\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<AdditionalDependencies>bass.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<SubSystem>Windows</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<AdditionalDependencies>bass.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="fxtest.c" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="fxtest.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View file

@ -0,0 +1,10 @@
include ..\makefile.in
TARGET = fxtest.exe
FLAGS += -mwindows
LIBS += -lcomdlg32 -lcomctl32
all: $(TARGET)
clean:
$(RM) $(OUTDIR)\$(TARGET)

View file

@ -0,0 +1,227 @@
/*
BASS full-duplex test
Copyright (c) 2002-2014 Un4seen Developments Ltd.
*/
#include <windows.h>
#include <commctrl.h>
#include <stdio.h>
#include <math.h>
#include "bass.h"
HWND win = NULL;
#define MESS(id,m,w,l) SendDlgItemMessage(win,id,m,(WPARAM)(w),(LPARAM)(l))
HRECORD rchan; // recording channel
HSTREAM chan; // playback stream
HFX fx[4] = { 0 }; // FX handles
int chunk; // recording chunk size
int input; // current input source
int latency = 0; // current latency
#define SAMPLERATE 44100
#define ADJUSTRATE // adjust the output rate (in case input and output devices are going at slightly different speeds)
DWORD rate; // current output rate
DWORD prebuf; // prebuffering amount
#ifdef ADJUSTRATE
DWORD targbuf; // target buffer level
DWORD prevbuf; // previous buffer level/threshold
#endif
void Error(const char *es)
{
char mes[200];
sprintf(mes, "%s\n(error code: %d)", es, BASS_ErrorGetCode());
MessageBox(win, mes, 0, 0);
}
BOOL CALLBACK RecordingCallback(HRECORD handle, const void *buffer, DWORD length, void *user)
{
DWORD bl;
BASS_StreamPutData(chan, buffer, length); // feed recorded data to output stream
bl = BASS_ChannelGetData(chan, NULL, BASS_DATA_AVAILABLE); // get output buffer level
if (prebuf) { // prebuffering
if (bl >= prebuf + length) { // gone 1 block past the prebuffering target
#ifdef ADJUSTRATE
targbuf = bl; // target the current level
prevbuf = 0;
#endif
prebuf = 0; // finished prebuffering
BASS_ChannelPlay(chan, FALSE); // start the output
}
} else { // playing
#ifdef ADJUSTRATE
if (bl < targbuf) { // buffer level is below target, slow down...
rate--;
BASS_ChannelSetAttribute(chan, BASS_ATTRIB_FREQ, rate);
prevbuf = 0;
} else if (bl > targbuf && bl >= prevbuf) { // buffer level is high and not falling, speed up...
rate++;
BASS_ChannelSetAttribute(chan, BASS_ATTRIB_FREQ, rate);
prevbuf = bl;
}
#endif
}
return TRUE; // continue recording
}
BOOL Initialize()
{
BASS_INFO bi;
// initialize default output device (and measure latency)
if (!BASS_Init(-1, SAMPLERATE, 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(SAMPLERATE, 2, 0, STREAMPROC_PUSH, 0);
rate = SAMPLERATE;
prebuf = BASS_ChannelSeconds2Bytes(chan, bi.minbuf / 1000.f); // prebuffer at least "minbuf" worth of data
// start recording with 10ms period
if (!BASS_RecordInit(-1) || !(rchan = BASS_RecordStart(SAMPLERATE, 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
}
}
}
return TRUE;
}
INT_PTR CALLBACK dialogproc(HWND h, UINT m, WPARAM w, LPARAM l)
{
switch (m) {
case WM_TIMER:
{ // display current latency (input+output buffer level)
char buf[20];
latency = (latency * 3 + BASS_ChannelGetData(chan, NULL, BASS_DATA_AVAILABLE)
+ BASS_ChannelGetData(rchan, NULL, BASS_DATA_AVAILABLE)) / 4;
sprintf(buf, "%d", (int)(BASS_ChannelBytes2Seconds(chan, latency) * 1000));
MESS(15, WM_SETTEXT, 0, buf);
}
break;
case WM_COMMAND:
switch (LOWORD(w)) {
case IDCANCEL:
EndDialog(h, 0);
break;
case 10:
if (HIWORD(w) == CBN_SELCHANGE) { // input selection changed
int i;
float level;
input = MESS(10, CB_GETCURSEL, 0, 0); // get the selection
for (i = 0; BASS_RecordSetInput(i, BASS_INPUT_OFF, -1); i++); // 1st disable all inputs, then...
BASS_RecordSetInput(input, BASS_INPUT_ON, -1); // enable the selected input
BASS_RecordGetInput(input, &level); // get the level
MESS(11, TBM_SETPOS, TRUE, level * 100);
}
break;
case 20: // toggle chorus
if (fx[0]) {
BASS_ChannelRemoveFX(chan, fx[0]);
fx[0] = 0;
} else
fx[0] = BASS_ChannelSetFX(chan, BASS_FX_DX8_CHORUS, 0);
break;
case 21: // toggle gargle
if (fx[1]) {
BASS_ChannelRemoveFX(chan, fx[1]);
fx[1] = 0;
} else
fx[1] = BASS_ChannelSetFX(chan, BASS_FX_DX8_GARGLE, 0);
break;
case 22: // toggle reverb
if (fx[2]) {
BASS_ChannelRemoveFX(chan, fx[2]);
fx[2] = 0;
} else
fx[2] = BASS_ChannelSetFX(chan, BASS_FX_DX8_REVERB, 0);
break;
case 23: // toggle flanger
if (fx[3]) {
BASS_ChannelRemoveFX(chan, fx[3]);
fx[3] = 0;
} else
fx[3] = BASS_ChannelSetFX(chan, BASS_FX_DX8_FLANGER, 0);
break;
}
break;
case WM_HSCROLL:
if (l) { // set input source level
float level = SendMessage((HWND)l, TBM_GETPOS, 0, 0) / 100.f;
if (!BASS_RecordSetInput(input, 0, level)) // failed to set input level
BASS_RecordSetInput(-1, 0, level); // try master level instead
}
break;
case WM_INITDIALOG:
win = h;
MESS(11, TBM_SETRANGE, FALSE, MAKELONG(0, 100)); // initialize input level slider
MessageBox(win,
"Do not set the input to 'WAVE' / 'What you hear' (etc...) with\n"
"the level set high, as that is likely to result in nasty feedback.\n",
"Feedback warning", MB_ICONWARNING);
if (!Initialize()) {
EndDialog(win, 0);
break;
}
SetTimer(h, 1, 250, NULL);
return 1;
case WM_DESTROY:
KillTimer(h, 1);
// release it all
BASS_RecordFree();
BASS_Free();
break;
}
return 0;
}
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
// check the correct BASS was loaded
if (HIWORD(BASS_GetVersion()) != BASSVERSION) {
MessageBox(0, "An incorrect version of BASS.DLL was loaded", 0, MB_ICONERROR);
return 0;
}
{ // enable trackbar support (for the level control)
INITCOMMONCONTROLSEX cc = { sizeof(cc),ICC_BAR_CLASSES };
InitCommonControlsEx(&cc);
}
DialogBox(hInstance, MAKEINTRESOURCE(1000), NULL, dialogproc);
return 0;
}

View file

@ -0,0 +1,57 @@
# Microsoft Developer Studio Project File - Name="livefx" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=livefx - Win32 Release
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "livefx.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "livefx.mak" CFG="livefx - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "livefx - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "../bin"
# PROP BASE Intermediate_Dir "Release"
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "../bin"
# PROP Intermediate_Dir "Release"
# ADD BASE CPP /nologo /MD /GX /I ".." /D "WIN32" /D "NDEBUG" /FD /c
# ADD CPP /nologo /MD /GX /I ".." /D "WIN32" /D "NDEBUG" /FD /c
BSC32=bscmake.exe
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib comctl32.lib /nologo /subsystem:windows /pdb:none /machine:I386
# ADD LINK32 kernel32.lib user32.lib comctl32.lib /nologo /subsystem:windows /pdb:none /machine:I386
# Begin Target
# Name "livefx - Win32 Release"
# Begin Source File
SOURCE=livefx.c
# End Source File
# Begin Source File
SOURCE=livefx.rc
# End Source File
# Begin Source File
SOURCE=..\bass.lib
# End Source File
# End Target
# End Project

View file

@ -0,0 +1,21 @@
#include "windows.h"
1000 DIALOG DISCARDABLE 200, 100, 220, 31
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "BASS full-duplex test with effects"
FONT 8, "MS Sans Serif"
BEGIN
COMBOBOX 10,5,5,65,72,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "",11,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS |
WS_TABSTOP,5,20,65,10
CTEXT "latency",-1,80,2,40,8
CTEXT "",15,80,12,40,13,SS_CENTERIMAGE | SS_SUNKEN
CONTROL "Chorus",20,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,130,5,
38,10
CONTROL "Gargle",21,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
130,18,38,10
CONTROL "Reverb",22,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,175,5,
39,10
CONTROL "Flanger",23,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,175,
18,39,10
END

View file

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="livefx"
ProjectGUID="{0C580261-3DF5-4160-BE1A-17BCC66BEE8C}"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory="..\bin"
ConfigurationType="1"
CharacterSet="0"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".."
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="2"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="bass.lib comctl32.lib"
AdditionalLibraryDirectories=".."
SubSystem="2"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="..\bin\x64"
ConfigurationType="1"
CharacterSet="0"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".."
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="2"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="bass.lib comctl32.lib"
AdditionalLibraryDirectories="..\x64"
SubSystem="2"
TargetMachine="17"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath="livefx.c"
>
</File>
<File
RelativePath="livefx.rc"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{0C580261-3DF5-4160-BE1A-17BCC66BEE8C}</ProjectGuid>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>..\bin\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>..\bin\x64\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<AdditionalDependencies>bass.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<SubSystem>Windows</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<AdditionalDependencies>bass.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="livefx.c" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="livefx.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View file

@ -0,0 +1,10 @@
include ..\makefile.in
TARGET = livefx.exe
FLAGS += -mwindows
LIBS += -lcomctl32
all: $(TARGET)
clean:
$(RM) $(OUTDIR)\$(TARGET)

View file

@ -0,0 +1,233 @@
/*
BASS "live" spectrum analyser example
Copyright (c) 2002-2014 Un4seen Developments Ltd.
*/
#include <windows.h>
#include <stdio.h>
#include <math.h>
#include "bass.h"
#define SPECWIDTH 368 // display width
#define SPECHEIGHT 127 // height (changing requires palette adjustments too)
HWND win = NULL;
DWORD timer = 0;
HRECORD chan; // recording channel
HDC specdc = 0;
HBITMAP specbmp = 0;
BYTE *specbuf;
int specmode = 0, specpos = 0; // spectrum mode (and marker pos for 3D mode)
// display error messages
void Error(const char *es)
{
char mes[200];
sprintf(mes, "%s\n(error code: %d)", es, BASS_ErrorGetCode());
MessageBox(win, mes, 0, 0);
}
// update the spectrum display - the interesting bit :)
void CALLBACK UpdateSpectrum(UINT uTimerID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2)
{
static DWORD quietcount = 0;
HDC dc;
int x, y, y1;
if (specmode == 3) { // waveform
short buf[SPECWIDTH];
memset(specbuf, 0, SPECWIDTH * SPECHEIGHT);
BASS_ChannelGetData(chan, buf, sizeof(buf)); // get the sample data
for (x = 0; x < SPECWIDTH; x++) {
int v = (32767 - buf[x]) * SPECHEIGHT / 65536; // invert and scale to fit display
if (!x) y = v;
do { // draw line from previous sample...
if (y < v) y++;
else if (y > v) y--;
specbuf[y * SPECWIDTH + x] = abs(y - SPECHEIGHT / 2) * 2 + 1;
} while (y != v);
}
} else {
float fft[1024];
BASS_ChannelGetData(chan, fft, BASS_DATA_FFT2048); // get the FFT data
if (!specmode) { // "normal" FFT
memset(specbuf, 0, SPECWIDTH * SPECHEIGHT);
for (x = 0; x < SPECWIDTH / 2; x++) {
#if 1
y = sqrt(fft[x + 1]) * 3 * SPECHEIGHT - 4; // scale it (sqrt to make low values more visible)
#else
y = fft[x + 1] * 10 * SPECHEIGHT; // scale it (linearly)
#endif
if (y > SPECHEIGHT) y = SPECHEIGHT; // cap it
if (x && (y1 = (y + y1) / 2)) // interpolate from previous to make the display smoother
while (--y1 >= 0) specbuf[y1 * SPECWIDTH + x * 2 - 1] = y1 + 1;
y1 = y;
while (--y >= 0) specbuf[y * SPECWIDTH + x * 2] = y + 1; // draw level
}
} else if (specmode == 1) { // logarithmic, combine bins
int b0 = 0;
memset(specbuf, 0, SPECWIDTH * SPECHEIGHT);
#define BANDS 28
for (x = 0; x < BANDS; x++) {
float peak = 0;
int b1 = pow(2, x * 10.0 / (BANDS - 1));
if (b1 <= b0) b1 = b0 + 1; // make sure it uses at least 1 FFT bin
if (b1 > 1023) b1 = 1023;
for (; b0 < b1; b0++)
if (peak < fft[1 + b0]) peak = fft[1 + b0];
y = sqrt(peak) * 3 * SPECHEIGHT - 4; // scale it (sqrt to make low values more visible)
if (y > SPECHEIGHT) y = SPECHEIGHT; // cap it
while (--y >= 0)
memset(specbuf + y * SPECWIDTH + x * (SPECWIDTH / BANDS), y + 1, SPECWIDTH / BANDS - 2); // draw bar
}
} else { // "3D"
for (x = 0; x < SPECHEIGHT; x++) {
y = sqrt(fft[x + 1]) * 3 * 127; // scale it (sqrt to make low values more visible)
if (y > 127) y = 127; // cap it
specbuf[x * SPECWIDTH + specpos] = 128 + y; // plot it
}
// move marker onto next position
specpos = (specpos + 1) % SPECWIDTH;
for (x = 0; x < SPECHEIGHT; x++) specbuf[x * SPECWIDTH + specpos] = 255;
}
}
// update the display
dc = GetDC(win);
BitBlt(dc, 0, 0, SPECWIDTH, SPECHEIGHT, specdc, 0, 0, SRCCOPY);
if (LOWORD(BASS_ChannelGetLevel(chan)) < 1000) { // check if it's quiet
quietcount++;
if (quietcount > 40 && (quietcount & 16)) { // it's been quiet for over a second
RECT r = { 0,0,SPECWIDTH,SPECHEIGHT };
SetTextColor(dc, 0xffffff);
SetBkMode(dc, TRANSPARENT);
DrawText(dc, "make some noise!", -1, &r, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
}
} else
quietcount = 0; // not quiet
ReleaseDC(win, dc);
}
// Recording callback - not doing anything with the data
BOOL CALLBACK DuffRecording(HRECORD handle, const void *buffer, DWORD length, void *user)
{
return TRUE; // continue recording
}
// window procedure
LRESULT CALLBACK SpectrumWindowProc(HWND h, UINT m, WPARAM w, LPARAM l)
{
switch (m) {
case WM_PAINT:
if (GetUpdateRect(h, 0, 0)) {
PAINTSTRUCT p;
HDC dc;
if (!(dc = BeginPaint(h, &p))) return 0;
BitBlt(dc, 0, 0, SPECWIDTH, SPECHEIGHT, specdc, 0, 0, SRCCOPY);
EndPaint(h, &p);
}
return 0;
case WM_LBUTTONUP:
specmode = (specmode + 1) % 4; // change spectrum mode
memset(specbuf, 0, SPECWIDTH * SPECHEIGHT); // clear display
return 0;
case WM_CREATE:
win = h;
// initialize default recording device
if (!BASS_RecordInit(-1)) {
Error("Can't initialize device");
return -1;
}
// start recording (44100hz mono 16-bit)
if (!(chan = BASS_RecordStart(44100, 1, 0, &DuffRecording, 0))) {
Error("Can't start recording");
return -1;
}
{ // create bitmap to draw spectrum in (8 bit for easy updating)
BYTE data[2000] = { 0 };
BITMAPINFOHEADER *bh = (BITMAPINFOHEADER*)data;
RGBQUAD *pal = (RGBQUAD*)(data + sizeof(*bh));
int a;
bh->biSize = sizeof(*bh);
bh->biWidth = SPECWIDTH;
bh->biHeight = SPECHEIGHT; // upside down (line 0=bottom)
bh->biPlanes = 1;
bh->biBitCount = 8;
bh->biClrUsed = bh->biClrImportant = 256;
// setup palette
for (a = 1; a < 128; a++) {
pal[a].rgbGreen = 256 - 2 * a;
pal[a].rgbRed = 2 * a;
}
for (a = 0; a < 32; a++) {
pal[128 + a].rgbBlue = 8 * a;
pal[128 + 32 + a].rgbBlue = 255;
pal[128 + 32 + a].rgbRed = 8 * a;
pal[128 + 64 + a].rgbRed = 255;
pal[128 + 64 + a].rgbBlue = 8 * (31 - a);
pal[128 + 64 + a].rgbGreen = 8 * a;
pal[128 + 96 + a].rgbRed = 255;
pal[128 + 96 + a].rgbGreen = 255;
pal[128 + 96 + a].rgbBlue = 8 * a;
}
// create the bitmap
specbmp = CreateDIBSection(0, (BITMAPINFO*)bh, DIB_RGB_COLORS, (void**)&specbuf, NULL, 0);
specdc = CreateCompatibleDC(0);
SelectObject(specdc, specbmp);
}
// start update timer (40hz)
timer = timeSetEvent(25, 25, (LPTIMECALLBACK)&UpdateSpectrum, 0, TIME_PERIODIC);
break;
case WM_DESTROY:
if (timer) timeKillEvent(timer);
BASS_RecordFree();
if (specdc) DeleteDC(specdc);
if (specbmp) DeleteObject(specbmp);
PostQuitMessage(0);
break;
}
return DefWindowProc(h, m, w, l);
}
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
WNDCLASS wc = { 0 };
MSG msg;
// check the correct BASS was loaded
if (HIWORD(BASS_GetVersion()) != BASSVERSION) {
MessageBox(0, "An incorrect version of BASS.DLL was loaded", 0, MB_ICONERROR);
return 0;
}
// register window class and create the window
wc.lpfnWndProc = SpectrumWindowProc;
wc.hInstance = hInstance;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.lpszClassName = "BASS-Spectrum";
if (!RegisterClass(&wc) || !CreateWindow("BASS-Spectrum",
"BASS \"live\" spectrum (click to switch mode)",
WS_POPUPWINDOW | WS_CAPTION | WS_VISIBLE, 200, 200,
SPECWIDTH + 2 * GetSystemMetrics(SM_CXDLGFRAME),
SPECHEIGHT + GetSystemMetrics(SM_CYCAPTION) + 2 * GetSystemMetrics(SM_CYDLGFRAME),
NULL, NULL, hInstance, NULL)) {
Error("Can't create window");
return 0;
}
ShowWindow(win, SW_SHOWNORMAL);
while (GetMessage(&msg, NULL, 0, 0) > 0) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}

View file

@ -0,0 +1,53 @@
# Microsoft Developer Studio Project File - Name="livespec" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=livespec - Win32 Release
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "livespec.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "livespec.mak" CFG="livespec - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "livespec - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "../bin"
# PROP BASE Intermediate_Dir "Release"
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "../bin"
# PROP Intermediate_Dir "Release"
# ADD BASE CPP /nologo /MD /GX /I ".." /D "WIN32" /D "NDEBUG" /FD /c
# ADD CPP /nologo /MD /GX /I ".." /D "WIN32" /D "NDEBUG" /FD /c
BSC32=bscmake.exe
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winmm.lib /nologo /subsystem:windows /pdb:none /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winmm.lib /nologo /subsystem:windows /pdb:none /machine:I386
# Begin Target
# Name "livespec - Win32 Release"
# Begin Source File
SOURCE=livespec.c
# End Source File
# Begin Source File
SOURCE=..\bass.lib
# End Source File
# End Target
# End Project

View file

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="livespec"
ProjectGUID="{6AAE12B9-8731-4CDE-BD76-EC5B4EC5AE48}"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory="..\bin"
ConfigurationType="1"
CharacterSet="0"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".."
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="2"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="bass.lib winmm.lib"
AdditionalLibraryDirectories=".."
SubSystem="2"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="..\bin\x64"
ConfigurationType="1"
CharacterSet="0"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".."
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="2"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="bass.lib winmm.lib"
AdditionalLibraryDirectories="..\x64"
SubSystem="2"
TargetMachine="17"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath="livespec.c"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{6AAE12B9-8731-4CDE-BD76-EC5B4EC5AE48}</ProjectGuid>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>..\bin\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>..\bin\x64\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<AdditionalDependencies>bass.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<SubSystem>Windows</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<AdditionalDependencies>bass.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="livespec.c" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View file

@ -0,0 +1,10 @@
include ..\makefile.in
TARGET = livespec.exe
FLAGS += -mwindows
LIBS += -lgdi32 -lwinmm
all: $(TARGET)
clean:
$(RM) $(OUTDIR)\$(TARGET)

View file

@ -0,0 +1,11 @@
EXAMPLES = 3dtest basstest contest custloop devlist dsptest fxtest livefx livespec modtest multi netradio plugins rectest speakers spectrum synth writewav
.PHONY: all clean $(EXAMPLES)
all: $(EXAMPLES)
clean:
@$(foreach x,$(EXAMPLES),$(MAKE) -C $(x) clean;)
$(EXAMPLES):
$(MAKE) -C $@

View file

@ -0,0 +1,17 @@
FLAGS = -Os -I.. -L..
LIBS = -lbass
OUTDIR = ..\bin
CC = gcc
RM = del
RES = windres
%.exe: %.c %.rc
$(RES) -i $*.rc -o rsrc.obj
$(CC) $(FLAGS) $*.c rsrc.obj $(LIBS) -o $(OUTDIR)\$@
$(RM) rsrc.obj
%.exe: %.c
$(CC) $(FLAGS) $*.c $(LIBS) -o $(OUTDIR)\$@
.PHONY: all clean

View file

@ -0,0 +1,10 @@
include ..\makefile.in
TARGET = modtest.exe
FLAGS += -mwindows
LIBS += -lcomdlg32
all: $(TARGET)
clean:
$(RM) $(OUTDIR)\$(TARGET)

View file

@ -0,0 +1,192 @@
/*
BASS MOD music test
Copyright (c) 1999-2014 Un4seen Developments Ltd.
*/
#include <windows.h>
#include <stdio.h>
#include <commctrl.h>
#include "bass.h"
HWND win = NULL;
DWORD music; // the HMUSIC channel
OPENFILENAME ofn;
// display error messages
void Error(char *es)
{
char mes[200];
sprintf(mes, "%s\n(error code: %d)", es, BASS_ErrorGetCode());
MessageBox(win, mes, "Error", 0);
}
#define MESS(id,m,w,l) SendDlgItemMessage(win,id,m,(WPARAM)w,(LPARAM)l)
DWORD GetFlags()
{
DWORD flags = BASS_MUSIC_POSRESET; // stop notes when seeking
switch (MESS(21, CB_GETCURSEL, 0, 0)) {
case 0:
flags |= BASS_MUSIC_NONINTER; // no interpolation
break;
case 2:
flags |= BASS_MUSIC_SINCINTER; // sinc interpolation
break;
}
switch (MESS(22, CB_GETCURSEL, 0, 0)) {
case 1:
flags |= BASS_MUSIC_RAMP; // ramping
break;
case 2:
flags |= BASS_MUSIC_RAMPS; // "sensitive" ramping
break;
}
switch (MESS(23, CB_GETCURSEL, 0, 0)) {
case 1:
flags |= BASS_MUSIC_SURROUND; // surround
break;
case 2:
flags |= BASS_MUSIC_SURROUND2; // "mode2"
break;
}
return flags;
}
INT_PTR CALLBACK dialogproc(HWND h, UINT m, WPARAM w, LPARAM l)
{
switch (m) {
case WM_TIMER:
{ // update display
char text[16];
QWORD pos = BASS_ChannelGetPosition(music, BASS_POS_MUSIC_ORDER);
if (pos != (QWORD)-1) {
MESS(20, TBM_SETPOS, 1, LOWORD(pos));
sprintf(text, "%03d.%03d", LOWORD(pos), HIWORD(pos));
MESS(15, WM_SETTEXT, 0, text);
}
}
break;
case WM_COMMAND:
switch (LOWORD(w)) {
case IDCANCEL:
EndDialog(h, 0);
break;
case 10:
{
char file[MAX_PATH] = "";
ofn.lpstrFilter = "mo3/it/xm/s3m/mtm/mod/umx files\0*.mo3;*.xm;*.mod;*.s3m;*.it;*.mtm;*.umx\0All files\0*.*\0\0";
ofn.lpstrFile = file;
if (GetOpenFileName(&ofn)) {
BASS_MusicFree(music); // free the current music
music = BASS_MusicLoad(FALSE, file, 0, 0, GetFlags(), 1); // load the new music
if (music) { // success
DWORD length = BASS_ChannelGetLength(music, BASS_POS_MUSIC_ORDER); // get the order length
MESS(10, WM_SETTEXT, 0, file);
{
char text[100], *ctype = "";
BASS_CHANNELINFO info;
int channels = 0;
while (BASS_ChannelGetAttributeEx(music, BASS_ATTRIB_MUSIC_VOL_CHAN + channels, 0, 0)) channels++; // count channels
BASS_ChannelGetInfo(music, &info);
switch (info.ctype & ~BASS_CTYPE_MUSIC_MO3) {
case BASS_CTYPE_MUSIC_MOD:
ctype = "MOD";
break;
case BASS_CTYPE_MUSIC_MTM:
ctype = "MTM";
break;
case BASS_CTYPE_MUSIC_S3M:
ctype = "S3M";
break;
case BASS_CTYPE_MUSIC_XM:
ctype = "XM";
break;
case BASS_CTYPE_MUSIC_IT:
ctype = "IT";
break;
}
_snprintf(text, sizeof(text), "name: %s, format: %dch %s%s", BASS_ChannelGetTags(music, BASS_TAG_MUSIC_NAME), channels, ctype, info.ctype & BASS_CTYPE_MUSIC_MO3 ? " (MO3)" : "");
MESS(11, WM_SETTEXT, 0, text);
}
MESS(20, TBM_SETRANGEMAX, 1, length - 1); // update scroller range
BASS_ChannelPlay(music, FALSE); // start it
} else { // failed
MESS(10, WM_SETTEXT, 0, "click here to open a file...");
MESS(11, WM_SETTEXT, 0, "");
MESS(15, WM_SETTEXT, 0, "");
Error("Can't play the file");
}
}
}
break;
case 12:
if (BASS_ChannelIsActive(music) == BASS_ACTIVE_PLAYING)
BASS_ChannelPause(music);
else
BASS_ChannelPlay(music, FALSE);
break;
case 21:
case 22:
case 23:
BASS_ChannelFlags(music, GetFlags(), -1); // update flags
break;
}
break;
case WM_HSCROLL:
if (l && LOWORD(w) != SB_THUMBPOSITION && LOWORD(w) != SB_ENDSCROLL) {
int pos = SendMessage((HWND)l, TBM_GETPOS, 0, 0);
BASS_ChannelSetPosition(music, pos, BASS_POS_MUSIC_ORDER); // set the position
}
break;
case WM_INITDIALOG:
win = h;
// initialize default output device
if (!BASS_Init(-1, 44100, 0, win, NULL)) {
Error("Can't initialize device");
EndDialog(h, 0);
break;
}
memset(&ofn, 0, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = h;
ofn.nMaxFile = MAX_PATH;
ofn.Flags = OFN_HIDEREADONLY | OFN_EXPLORER;
MESS(21, CB_ADDSTRING, 0, "off");
MESS(21, CB_ADDSTRING, 0, "linear");
MESS(21, CB_ADDSTRING, 0, "sinc");
MESS(21, CB_SETCURSEL, 1, 0);
MESS(22, CB_ADDSTRING, 0, "off");
MESS(22, CB_ADDSTRING, 0, "normal");
MESS(22, CB_ADDSTRING, 0, "sensitive");
MESS(22, CB_SETCURSEL, 2, 0);
MESS(23, CB_ADDSTRING, 0, "off");
MESS(23, CB_ADDSTRING, 0, "mode1");
MESS(23, CB_ADDSTRING, 0, "mode2");
MESS(23, CB_SETCURSEL, 0, 0);
SetTimer(win, 1, 100, NULL);
return 1;
case WM_DESTROY:
BASS_Free();
break;
}
return 0;
}
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
// check the correct BASS was loaded
if (HIWORD(BASS_GetVersion()) != BASSVERSION) {
MessageBox(0, "An incorrect version of BASS.DLL was loaded", 0, MB_ICONERROR);
return 0;
}
DialogBox(hInstance, MAKEINTRESOURCE(1000), NULL, dialogproc);
return 0;
}

View file

@ -0,0 +1,57 @@
# Microsoft Developer Studio Project File - Name="modtest" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=modtest - Win32 Release
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "modtest.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "modtest.mak" CFG="modtest - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "modtest - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "../bin"
# PROP BASE Intermediate_Dir "Release"
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "../bin"
# PROP Intermediate_Dir "Release"
# ADD BASE CPP /nologo /MD /GX /I ".." /D "WIN32" /D "NDEBUG" /FD /c
# ADD CPP /nologo /MD /GX /I ".." /D "WIN32" /D "NDEBUG" /FD /c
BSC32=bscmake.exe
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib comdlg32.lib /nologo /subsystem:windows /pdb:none /machine:I386
# ADD LINK32 kernel32.lib user32.lib comdlg32.lib /nologo /subsystem:windows /pdb:none /machine:I386
# Begin Target
# Name "modtest - Win32 Release"
# Begin Source File
SOURCE=modtest.c
# End Source File
# Begin Source File
SOURCE=modtest.rc
# End Source File
# Begin Source File
SOURCE=..\bass.lib
# End Source File
# End Target
# End Project

View file

@ -0,0 +1,23 @@
#include "windows.h"
1000 DIALOG DISCARDABLE 100, 100, 200, 88
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "BASS MOD music test"
FONT 8, "MS Sans Serif"
BEGIN
PUSHBUTTON "click here to open a file...",10,5,5,190,14
CTEXT "",11,5,21,190,8
CTEXT "",15,20,34,45,10,SS_SUNKEN
PUSHBUTTON "Play / Pause",12,120,33,60,12
CONTROL "Slider1",20,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS |
WS_TABSTOP,5,48,190,12
CTEXT "Interpolation",-1,22,61,45,8
COMBOBOX 21,22,70,45,70,CBS_DROPDOWNLIST | WS_VSCROLL |
WS_TABSTOP
CTEXT "Ramping",-1,77,61,45,8
COMBOBOX 22,77,70,45,70,CBS_DROPDOWNLIST | WS_VSCROLL |
WS_TABSTOP
CTEXT "Surround",-1,132,61,45,8
COMBOBOX 23,132,70,45,70,CBS_DROPDOWNLIST | WS_VSCROLL |
WS_TABSTOP
END

View file

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="modtest"
ProjectGUID="{9465CD7D-3DAC-472F-AA85-DD144AC094F7}"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory="..\bin"
ConfigurationType="1"
CharacterSet="0"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".."
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="2"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="bass.lib"
AdditionalLibraryDirectories=".."
SubSystem="2"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="..\bin\x64"
ConfigurationType="1"
CharacterSet="0"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".."
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="2"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="bass.lib"
AdditionalLibraryDirectories="..\x64"
SubSystem="2"
TargetMachine="17"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath="modtest.c"
>
</File>
<File
RelativePath="modtest.rc"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{9465CD7D-3DAC-472F-AA85-DD144AC094F7}</ProjectGuid>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>..\bin\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>..\bin\x64\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<AdditionalDependencies>bass.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<SubSystem>Windows</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<AdditionalDependencies>bass.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="modtest.c" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="modtest.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View file

@ -0,0 +1,10 @@
include ..\makefile.in
TARGET = multi.exe
FLAGS += -mwindows
LIBS += -lcomdlg32
all: $(TARGET)
clean:
$(RM) $(OUTDIR)\$(TARGET)

View file

@ -0,0 +1,216 @@
/*
BASS multiple output example
Copyright (c) 2001-2008 Un4seen Developments Ltd.
*/
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include "bass.h"
HWND win = NULL;
DWORD outdev[2]; // output devices
DWORD latency[2]; // latencies
HSTREAM chan[2]; // the streams
// display error messages
void Error(const char *es)
{
char mes[200];
sprintf(mes, "%s\n(error code: %d)", es, BASS_ErrorGetCode());
MessageBox(win, mes, 0, 0);
}
// Cloning DSP function
void CALLBACK CloneDSP(HDSP handle, DWORD channel, void *buffer, DWORD length, void *user)
{
BASS_StreamPutData((HSTREAM)user, buffer, length); // user = clone
}
#define MESS(id,m,w,l) SendDlgItemMessage(win,id,m,(WPARAM)(w),(LPARAM)(l))
INT_PTR CALLBACK dialogproc(HWND h, UINT m, WPARAM w, LPARAM l)
{
static OPENFILENAME ofn;
switch (m) {
case WM_COMMAND:
switch (LOWORD(w)) {
case IDCANCEL:
EndDialog(h, 0);
break;
case 10: // open a file to play on device #1
case 11: // open a file to play on device #2
{
int devn = LOWORD(w) - 10;
char file[MAX_PATH] = "";
ofn.lpstrFilter = "streamable files\0*.mp3;*.mp2;*.mp1;*.ogg;*.wav;*.aif\0All files\0*.*\0\0";
ofn.lpstrFile = file;
if (GetOpenFileName(&ofn)) {
BASS_StreamFree(chan[devn]); // free old stream
BASS_SetDevice(outdev[devn]); // set the device to create stream on
if (!(chan[devn] = BASS_StreamCreateFile(FALSE, file, 0, 0, BASS_SAMPLE_LOOP))) {
MESS(10 + devn, WM_SETTEXT, 0, "click here to open a file...");
Error("Can't play the file");
break;
}
BASS_ChannelPlay(chan[devn], FALSE); // play new stream
MESS(10 + devn, WM_SETTEXT, 0, file);
}
}
break;
case 15: // clone on device #1
case 16: // clone on device #2
{
int devn = LOWORD(w) - 15;
BASS_CHANNELINFO i;
if (!BASS_ChannelGetInfo(chan[devn ^ 1], &i)) {
Error("Nothing to clone");
break;
}
BASS_StreamFree(chan[devn]); // free old stream
BASS_SetDevice(outdev[devn]); // set the device to create stream on
if (!(chan[devn] = BASS_StreamCreate(i.freq, i.chans, i.flags, STREAMPROC_PUSH, 0))) { // create a "push" stream
MESS(10 + devn, WM_SETTEXT, 0, "click here to open a file...");
Error("Can't create clone");
break;
}
BASS_ChannelLock(chan[devn ^ 1], TRUE); // lock source stream to synchonise buffer contents
BASS_ChannelSetDSP(chan[devn ^ 1], CloneDSP, (void*)chan[devn], 0); // set DSP to feed data to clone
{ // copy buffered data to clone
DWORD d = BASS_ChannelSeconds2Bytes(chan[devn], latency[devn] / 1000.f); // playback delay
DWORD c = BASS_ChannelGetData(chan[devn ^ 1], 0, BASS_DATA_AVAILABLE);
BYTE *buf = (BYTE*)malloc(c);
c = BASS_ChannelGetData(chan[devn ^ 1], buf, c);
if (c > d) BASS_StreamPutData(chan[devn], buf + d, c - d);
free(buf);
}
BASS_ChannelLock(chan[devn ^ 1], FALSE); // unlock source stream
BASS_ChannelPlay(chan[devn], FALSE); // play clone
MESS(10 + devn, WM_SETTEXT, 0, "clone");
}
break;
case 30: // swap channel devices
{
{ // swap handles
HSTREAM temp = chan[0];
chan[0] = chan[1];
chan[1] = temp;
}
{ // swap text
char temp1[MAX_PATH], temp2[MAX_PATH];
MESS(10, WM_GETTEXT, MAX_PATH, temp1);
MESS(11, WM_GETTEXT, MAX_PATH, temp2);
MESS(10, WM_SETTEXT, 0, temp2);
MESS(11, WM_SETTEXT, 0, temp1);
}
// update the channel devices
BASS_ChannelSetDevice(chan[0], outdev[0]);
BASS_ChannelSetDevice(chan[1], outdev[1]);
}
break;
}
break;
case WM_INITDIALOG:
win = h;
memset(&ofn, 0, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = h;
ofn.nMaxFile = MAX_PATH;
ofn.Flags = OFN_HIDEREADONLY | OFN_EXPLORER;
{ // initialize output devices
BASS_INFO info;
if (!BASS_Init(outdev[0], 44100, BASS_DEVICE_LATENCY, win, NULL)) {
Error("Can't initialize device 1");
EndDialog(h, 0);
}
BASS_GetInfo(&info);
latency[0] = info.latency;
if (!BASS_Init(outdev[1], 44100, BASS_DEVICE_LATENCY, win, NULL)) {
Error("Can't initialize device 2");
EndDialog(h, 0);
}
BASS_GetInfo(&info);
latency[1] = info.latency;
}
{
BASS_DEVICEINFO i;
BASS_GetDeviceInfo(outdev[0], &i);
MESS(20, WM_SETTEXT, 0, i.name);
BASS_GetDeviceInfo(outdev[1], &i);
MESS(21, WM_SETTEXT, 0, i.name);
}
return 1;
case WM_DESTROY:
// release both devices
BASS_SetDevice(outdev[0]);
BASS_Free();
BASS_SetDevice(outdev[1]);
BASS_Free();
break;
}
return 0;
}
// Simple device selector dialog stuff begins here
INT_PTR CALLBACK devicedialogproc(HWND h, UINT m, WPARAM w, LPARAM l)
{
switch (m) {
case WM_COMMAND:
switch (LOWORD(w)) {
case 10:
if (HIWORD(w) != LBN_DBLCLK) break;
case IDOK:
{
int device = SendDlgItemMessage(h, 10, LB_GETCURSEL, 0, 0);
device = SendDlgItemMessage(h, 10, LB_GETITEMDATA, device, 0); // get device #
EndDialog(h, device);
}
break;
}
break;
case WM_INITDIALOG:
{
char text[30];
BASS_DEVICEINFO i;
int c;
sprintf(text, "Select output device #%d", l);
SetWindowText(h, text);
for (c = 1; BASS_GetDeviceInfo(c, &i); c++) { // device 1 = 1st real device
if (i.flags & BASS_DEVICE_ENABLED) { // enabled, so add it...
int idx = SendDlgItemMessage(h, 10, LB_ADDSTRING, 0, (LPARAM)i.name);
SendDlgItemMessage(h, 10, LB_SETITEMDATA, idx, c); // store device #
}
}
SendDlgItemMessage(h, 10, LB_SETCURSEL, 0, 0);
}
return 1;
}
return 0;
}
// Device selector stuff ends here
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
// check the correct BASS was loaded
if (HIWORD(BASS_GetVersion()) != BASSVERSION) {
MessageBox(0, "An incorrect version of BASS.DLL was loaded", 0, MB_ICONERROR);
return 0;
}
// Let the user choose the output devices
outdev[0] = DialogBoxParam(hInstance, MAKEINTRESOURCE(2000), NULL, devicedialogproc, 1);
outdev[1] = DialogBoxParam(hInstance, MAKEINTRESOURCE(2000), NULL, devicedialogproc, 2);
// main dialog
DialogBox(hInstance, MAKEINTRESOURCE(1000), NULL, dialogproc);
return 0;
}

View file

@ -0,0 +1,57 @@
# Microsoft Developer Studio Project File - Name="multi" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=multi - Win32 Release
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "multi.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "multi.mak" CFG="multi - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "multi - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "../bin"
# PROP BASE Intermediate_Dir "Release"
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "../bin"
# PROP Intermediate_Dir "Release"
# ADD BASE CPP /nologo /MD /GX /I ".." /D "WIN32" /D "NDEBUG" /FD /c
# ADD CPP /nologo /MD /GX /I ".." /D "WIN32" /D "NDEBUG" /FD /c
BSC32=bscmake.exe
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib comdlg32.lib /nologo /subsystem:windows /pdb:none /machine:I386
# ADD LINK32 kernel32.lib user32.lib comdlg32.lib /nologo /subsystem:windows /pdb:none /machine:I386
# Begin Target
# Name "multi - Win32 Release"
# Begin Source File
SOURCE=multi.c
# End Source File
# Begin Source File
SOURCE=multi.rc
# End Source File
# Begin Source File
SOURCE=..\bass.lib
# End Source File
# End Target
# End Project

View file

@ -0,0 +1,25 @@
#include "windows.h"
1000 DIALOG DISCARDABLE 100, 100, 260, 68
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "BASS multiple output example"
FONT 8, "MS Sans Serif"
BEGIN
GROUPBOX "",20,5,2,250,29
PUSHBUTTON "click here to open a file...",10,10,11,180,14
GROUPBOX "",21,5,35,250,29
PUSHBUTTON "click here to open a file...",11,10,44,180,14
PUSHBUTTON "clone #2",15,195,11,40,14
PUSHBUTTON "clone #1",16,195,44,40,14
PUSHBUTTON "swap",30,225,27,25,14
END
2000 DIALOG DISCARDABLE 115, 100, 170, 60
STYLE WS_POPUP | WS_VISIBLE | WS_CAPTION
FONT 8, "MS Sans Serif"
BEGIN
LISTBOX 10,5,5,160,35,LBS_NOINTEGRALHEIGHT | WS_VSCROLL |
WS_TABSTOP
DEFPUSHBUTTON "OK",IDOK,100,44,60,12
END

View file

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="multi"
ProjectGUID="{305E5C8D-85DB-4E36-A82E-856BC9972413}"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory="..\bin"
ConfigurationType="1"
CharacterSet="0"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".."
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="2"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="bass.lib"
AdditionalLibraryDirectories=".."
SubSystem="2"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="..\bin\x64"
ConfigurationType="1"
CharacterSet="0"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".."
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="2"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="bass.lib"
AdditionalLibraryDirectories="..\x64"
SubSystem="2"
TargetMachine="17"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath="multi.c"
>
</File>
<File
RelativePath="multi.rc"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{305E5C8D-85DB-4E36-A82E-856BC9972413}</ProjectGuid>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>..\bin\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>..\bin\x64\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<AdditionalDependencies>bass.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<SubSystem>Windows</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<AdditionalDependencies>bass.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="multi.c" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="multi.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View file

@ -0,0 +1,9 @@
include ..\makefile.in
TARGET = netradio.exe
FLAGS += -mwindows
all: $(TARGET)
clean:
$(RM) $(OUTDIR)\$(TARGET)

View file

@ -0,0 +1,242 @@
/*
BASS internet radio example
Copyright (c) 2002-2019 Un4seen Developments Ltd.
*/
#include <windows.h>
#include <process.h>
#include <stdio.h>
#include "bass.h"
// HLS definitions (copied from BASSHLS.H)
#define BASS_SYNC_HLS_SEGMENT 0x10300
#define BASS_TAG_HLS_EXTINF 0x14000
HWND win = NULL;
CRITICAL_SECTION lock;
DWORD req = 0; // request number/counter
HSTREAM chan; // stream handle
const char *urls[10] = { // preset stream URLs
"http://stream-dc1.radioparadise.com/rp_192m.ogg", "http://www.radioparadise.com/m3u/mp3-32.m3u",
"http://network.absoluteradio.co.uk/core/audio/mp3/live.pls?service=a8bb", "http://network.absoluteradio.co.uk/core/audio/aacplus/live.pls?service=a8",
"http://somafm.com/secretagent.pls", "http://somafm.com/secretagent32.pls",
"http://somafm.com/suburbsofgoa.pls", "http://somafm.com/suburbsofgoa32.pls",
"http://ai-radio.org/256.ogg", "http://ai-radio.org/48.aacp"
};
// display error messages
void Error(const char *es)
{
char mes[200];
sprintf(mes, "%s\n(error code: %d)", es, BASS_ErrorGetCode());
MessageBox(win, mes, 0, 0);
}
#define MESS(id,m,w,l) SendDlgItemMessage(win,id,m,(WPARAM)(w),(LPARAM)(l))
// update stream title from metadata
void DoMeta()
{
const char *meta = BASS_ChannelGetTags(chan, BASS_TAG_META);
if (meta) { // got Shoutcast metadata
const char *p = strstr(meta, "StreamTitle='"); // locate the title
if (p) {
const char *p2 = strstr(p, "';"); // locate the end of it
if (p2) {
char *t = strdup(p + 13);
t[p2 - (p + 13)] = 0;
MESS(30, WM_SETTEXT, 0, t);
free(t);
}
}
} else {
meta = BASS_ChannelGetTags(chan, BASS_TAG_OGG);
if (meta) { // got Icecast/OGG tags
const char *artist = NULL, *title = NULL, *p = meta;
for (; *p; p += strlen(p) + 1) {
if (!strnicmp(p, "artist=", 7)) // found the artist
artist = p + 7;
if (!strnicmp(p, "title=", 6)) // found the title
title = p + 6;
}
if (title) {
if (artist) {
char text[100];
_snprintf(text, sizeof(text), "%s - %s", artist, title);
MESS(30, WM_SETTEXT, 0, text);
} else
MESS(30, WM_SETTEXT, 0, title);
}
} else {
meta = BASS_ChannelGetTags(chan, BASS_TAG_HLS_EXTINF);
if (meta) { // got HLS segment info
const char *p = strchr(meta, ',');
if (p) MESS(30, WM_SETTEXT, 0, p + 1);
}
}
}
}
void CALLBACK MetaSync(HSYNC handle, DWORD channel, DWORD data, void *user)
{
DoMeta();
}
void CALLBACK StallSync(HSYNC handle, DWORD channel, DWORD data, void *user)
{
if (!data) // stalled
SetTimer(win, 0, 50, 0); // start buffer monitoring
}
void CALLBACK EndSync(HSYNC handle, DWORD channel, DWORD data, void *user)
{
KillTimer(win, 0); // stop buffer monitoring
MESS(31, WM_SETTEXT, 0, "not playing");
MESS(30, WM_SETTEXT, 0, "");
MESS(32, WM_SETTEXT, 0, "");
}
void CALLBACK StatusProc(const void *buffer, DWORD length, void *user)
{
if (buffer && !length && (DWORD)user == req) // got HTTP/ICY tags, and this is still the current request
MESS(32, WM_SETTEXT, 0, buffer); // display status
}
void __cdecl OpenURL(void *url)
{
DWORD c, r;
EnterCriticalSection(&lock); // make sure only 1 thread at a time can do the following
r = ++req; // increment the request counter for this request
LeaveCriticalSection(&lock);
KillTimer(win, 0); // stop buffer monitoring
BASS_StreamFree(chan); // close old stream
MESS(31, WM_SETTEXT, 0, "connecting...");
MESS(30, WM_SETTEXT, 0, "");
MESS(32, WM_SETTEXT, 0, "");
c = BASS_StreamCreateURL(url, 0, BASS_STREAM_BLOCK | BASS_STREAM_STATUS | BASS_STREAM_AUTOFREE, StatusProc, (void*)r); // open URL
free(url); // free temp URL buffer
EnterCriticalSection(&lock);
if (r != req) { // there is a newer request, discard this stream
LeaveCriticalSection(&lock);
if (c) BASS_StreamFree(c);
return;
}
chan = c; // this is now the current stream
LeaveCriticalSection(&lock);
if (!chan) { // failed to open
MESS(31, WM_SETTEXT, 0, "not playing");
Error("Can't play the stream");
} else {
// start buffer monitoring
SetTimer(win, 0, 50, 0);
// set syncs for stream title updates
BASS_ChannelSetSync(chan, BASS_SYNC_META, 0, MetaSync, 0); // Shoutcast
BASS_ChannelSetSync(chan, BASS_SYNC_OGG_CHANGE, 0, MetaSync, 0); // Icecast/OGG
BASS_ChannelSetSync(chan, BASS_SYNC_HLS_SEGMENT, 0, MetaSync, 0); // HLS
// set sync for stalling/buffering
BASS_ChannelSetSync(chan, BASS_SYNC_STALL, 0, StallSync, 0);
// set sync for end of stream
BASS_ChannelSetSync(chan, BASS_SYNC_END, 0, EndSync, 0);
// play it!
BASS_ChannelPlay(chan, FALSE);
}
}
INT_PTR CALLBACK dialogproc(HWND h, UINT m, WPARAM w, LPARAM l)
{
switch (m) {
case WM_TIMER:
{ // monitor buffering progress
if (BASS_ChannelIsActive(chan) == BASS_ACTIVE_PLAYING) {
KillTimer(win, 0); // finished buffering, stop monitoring
MESS(31, WM_SETTEXT, 0, "playing");
{ // get the broadcast name and URL
const char *icy = BASS_ChannelGetTags(chan, BASS_TAG_ICY);
if (!icy) icy = BASS_ChannelGetTags(chan, BASS_TAG_HTTP); // no ICY tags, try HTTP
if (icy) {
for (; *icy; icy += strlen(icy) + 1) {
if (!strnicmp(icy, "icy-name:", 9))
MESS(31, WM_SETTEXT, 0, icy + 9);
if (!strnicmp(icy, "icy-url:", 8))
MESS(32, WM_SETTEXT, 0, icy + 8);
}
}
}
// get the stream title
DoMeta();
} else {
char text[32];
sprintf(text, "buffering... %d%%", 100 - (int)BASS_StreamGetFilePosition(chan, BASS_FILEPOS_BUFFERING));
MESS(31, WM_SETTEXT, 0, text);
}
}
break;
case WM_COMMAND:
switch (LOWORD(w)) {
case IDCANCEL:
EndDialog(h, 0);
return 1;
default:
if ((LOWORD(w) >= 10 && LOWORD(w) < 20) || LOWORD(w) == 21) {
char *url;
if (LOWORD(w) == 21) { // custom stream URL
char temp[200];
MESS(20, WM_GETTEXT, sizeof(temp), temp);
url = strdup(temp);
} else // preset
url = strdup(urls[LOWORD(w) - 10]);
if (MESS(41, BM_GETCHECK, 0, 0))
BASS_SetConfigPtr(BASS_CONFIG_NET_PROXY, NULL); // disable proxy
else {
char proxy[100];
GetDlgItemText(win, 40, proxy, sizeof(proxy) - 1);
proxy[sizeof(proxy) - 1] = 0;
BASS_SetConfigPtr(BASS_CONFIG_NET_PROXY, proxy); // set proxy server
}
// open URL in a new thread (so that main thread is free)
_beginthread(OpenURL, 0, url);
}
}
break;
case WM_INITDIALOG:
win = h;
// initialize default output device
if (!BASS_Init(-1, 44100, 0, win, NULL)) {
Error("Can't initialize device");
EndDialog(win, 0);
break;
}
InitializeCriticalSection(&lock);
MESS(20, WM_SETTEXT, 0, "http://");
return 1;
case WM_DESTROY:
BASS_Free();
break;
}
return 0;
}
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
// check the correct BASS was loaded
if (HIWORD(BASS_GetVersion()) != BASSVERSION) {
MessageBox(0, "An incorrect version of BASS.DLL was loaded", 0, MB_ICONERROR);
return 0;
}
BASS_SetConfig(BASS_CONFIG_NET_PLAYLIST, 1); // enable playlist processing
BASS_SetConfig(BASS_CONFIG_NET_PREBUF_WAIT, 0); // disable BASS_StreamCreateURL pre-buffering
BASS_PluginLoad("bass_aac.dll", 0); // load BASS_AAC (if present) for AAC support on older Windows
BASS_PluginLoad("bassflac.dll", 0); // load BASSFLAC (if present) for FLAC support
BASS_PluginLoad("basshls.dll", 0); // load BASSHLS (if present) for HLS support
// display the window
DialogBox(hInstance, MAKEINTRESOURCE(1000), NULL, dialogproc);
return 0;
}

View file

@ -0,0 +1,57 @@
# Microsoft Developer Studio Project File - Name="netradio" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=netradio - Win32 Release
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "netradio.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "netradio.mak" CFG="netradio - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "netradio - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "../bin"
# PROP BASE Intermediate_Dir "Release"
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "../bin"
# PROP Intermediate_Dir "Release"
# ADD BASE CPP /nologo /MD /GX /I ".." /D "WIN32" /D "NDEBUG" /FD /c
# ADD CPP /nologo /MD /GX /I ".." /D "WIN32" /D "NDEBUG" /FD /c
BSC32=bscmake.exe
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib /nologo /subsystem:windows /pdb:none /machine:I386
# ADD LINK32 kernel32.lib user32.lib /nologo /subsystem:windows /pdb:none /machine:I386
# Begin Target
# Name "netradio - Win32 Release"
# Begin Source File
SOURCE=netradio.c
# End Source File
# Begin Source File
SOURCE=netradio.rc
# End Source File
# Begin Source File
SOURCE=..\bass.lib
# End Source File
# End Target
# End Project

View file

@ -0,0 +1,33 @@
#include "windows.h"
1000 DIALOG DISCARDABLE 200, 50, 195, 185
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "BASS internet radio tuner"
FONT 8, "MS Sans Serif"
BEGIN
GROUPBOX "Presets",-1,5,2,185,45
LTEXT "High bitrate",-1,10,15,48,8
LTEXT "Low bitrate",-1,10,30,48,8
PUSHBUTTON "1",10,60,11,20,15
PUSHBUTTON "1",11,60,27,20,15
PUSHBUTTON "2",12,86,11,20,15
PUSHBUTTON "2",13,86,27,20,15
PUSHBUTTON "3",14,112,11,20,15
PUSHBUTTON "3",15,112,27,20,15
PUSHBUTTON "4",16,138,11,20,15
PUSHBUTTON "4",17,138,27,20,15
PUSHBUTTON "5",18,164,11,20,15
PUSHBUTTON "5",19,164,27,20,15
GROUPBOX "Custom",-1,5,50,185,28
EDITTEXT 20,10,60,145,12,ES_AUTOHSCROLL
PUSHBUTTON "open",21,160,60,25,12
GROUPBOX "Currently playing",-1,5,81,185,57
CTEXT "",30,10,91,175,16,SS_NOPREFIX
CTEXT "not playing",31,10,109,175,16,SS_NOPREFIX
CTEXT "",32,10,127,175,8,SS_NOPREFIX
GROUPBOX "Proxy server",-1,5,141,185,40
EDITTEXT 40,10,151,175,12,ES_AUTOHSCROLL
LTEXT "[user:pass@]server:port",-1,109,165,76,8
CONTROL "Direct connection",41,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,15,167,72,10
END

View file

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="netradio"
ProjectGUID="{DFA5AC9E-4073-4555-92E8-E4808EE32B43}"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory="..\bin"
ConfigurationType="1"
CharacterSet="0"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".."
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="2"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="bass.lib"
AdditionalLibraryDirectories=".."
SubSystem="2"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="..\bin\x64"
ConfigurationType="1"
CharacterSet="0"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".."
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="2"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="bass.lib"
AdditionalLibraryDirectories="..\x64"
SubSystem="2"
TargetMachine="17"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath="netradio.c"
>
</File>
<File
RelativePath="netradio.rc"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{DFA5AC9E-4073-4555-92E8-E4808EE32B43}</ProjectGuid>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>..\bin\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>..\bin\x64\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<AdditionalDependencies>bass.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<SubSystem>Windows</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<AdditionalDependencies>bass.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="netradio.c" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="netradio.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

Some files were not shown because too many files have changed in this diff Show more