I use ctypes to play AUDIO using bass.dll found here: Un4seen Developments - 2MIDI / BASS / MID2XM / MO3 / XM-EXE / XMPlay
I have gone so far and tried as they advised me at their forum entry here: New Python Developer with Bass
But I still get errors. Can anyone take code and analyze to point out source of error?
Here is the code, pse ignore any useless comment, I was using the editor as scratch pad too :D - #import ctypes module
-
import ctypes as ct
-
#import OS
-
import os
-
#get BOOL C++ value from ctypes
-
from ctypes.wintypes import BOOL
-
from ctypes.wintypes import HANDLE
-
#Loading the DLL see: http://www.daniweb.com/forums/thread160430.html
-
bass_dll = ct.windll.bass
-
#initialize the DLL
-
# sample I got somehwere: BASS_Init(-1,44100,0,win,NULL) win The application's main window... 0 = the current foreground window (use this for console applications).
-
#function to intialize the DLL
-
-
def onInit_Lib():
-
#define arg types
-
bass_dll.BASS_Init.argtypes = [ct.c_int, ct.c_int, ct.c_int, ct.c_int, ct.c_int]
-
#define result types
-
bass_dll.BASS_Init.restype = ct.c_int
-
#call function with args
-
c= bass_dll.BASS_Init(-1, 44100, 0,0, 0)
-
print c
-
-
def onStream():
-
#arg definitions
-
#HSTREAM BASS_StreamCreateFile(BOOL mem, void *file, QWORD offset, QWORD length, DWORD flags);
-
bass_dll.BASS_StreamCreateFile.argtypes = [BOOL, ct.c_char_p, ct.c_int , ct.c_int, ct.c_int]
-
#defining restypes
-
bass_dll.BASS_StreamCreateFile.restype = HANDLE
-
path = os.getcwd()
-
full = os.path.join(path, "test.mp3")
-
print full
-
stream = bass_dll.BASS_StreamCreateFile(False, full, 0, 0, 0)
-
print stream
-
return stream
-
-
def onPlay(stream):
-
#define args
-
#BASS_ChannelPlay(stream, FALSE); // play the stream
-
bass_dll.BASS_ChannelPlay.argtypes = [HANDLE, BOOL]
-
#call function
-
bass_dll.BASS_ChannelPlay(stream, False)
-
-
onInit_Lib()
-
stream = onStream()
-
onPlay(stream)
-
With thanks,
0 1288 Sign in to post your reply or Sign up for a free account.
Similar topics
by: Edward King |
last post by:
Hi!
I am trying to achieve the following:
I have a number of help pages (in the format help_nn.php where nn=helpid).
I want to be able to open a particular help page by calling the function...
|
by: sunfox |
last post by:
Please help!! I have a difficulty in writing an assignment which is
related to Visual C++ V6.0. Can anybody here assist me to write a
program which is able to run under DOS? The program will be...
|
by: d.warnermurray |
last post by:
I am doing a project for school that involves creating help files for a html
authoring tool.
If you could help me with answers to some questions it would really help.
1. What tasks do you expect...
|
by: dixie |
last post by:
Help, I'm really out of my depth here (not unusual I hear you say :-). I
have just installed HTML Help in an application. I told it in the Project
Properties the path to the help file. I then...
|
by: Paul Rubin |
last post by:
In Windows if you click the Help dropdown, IDLE launches a help window
as it should. The help contents are included in the installation.
In Linux, clicking Help launches a web browser, which is...
|
by: glenn123 |
last post by:
Hi, i am just about out of time to produce a working jukebox which has to perform these functions: to play music files when a track is chosen from a list which when the user presses the change genre...
|
by: JonathanOrlev |
last post by:
Hello everybody,
I wrote this comment in another message of mine, but decided to post it
again as a standalone message.
I think that Microsoft's Office 2003 help system is horrible, probably...
|
by: davy.zou |
last post by:
I have started learning c++ and I need help. I need to write a
program, the question is as follows.
At a post office, there are a certain number of 2, 7, and 9cents
stamps, now, given a total...
|
by: dsoutherland |
last post by:
I am so new to ASP I'm not sure I am breathing. A company one of my clients deals with provides information over the web. They provided the ASP code for a default web site that is used to...
|
by: menyki |
last post by:
help 'e debug
--------------------------------------------------------------------------------
I wrote the below code to input new data from name and address textbox of a form to microsoft...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |