Author Topic: BASS for WinCE  (Read 238066 times)

hc_dondon

  • Guest
Re: BASS for WinCE
« Reply #125 on: 7 Sep '09 - 07:07 »
i just want to ask why it wont play in another device. This code play no problem with a china based Device, i tried korean and it shows the error.(iStation PMP WincE5.0)

private void InitWavHeader(){           
FFileStream = new FileStream(FFileName,FileMode.Create,FileAccess.Write);
         FBinaryWriter = new BinaryWriter(FFileStream);
         FBinaryWriter.Write(new char[4] { 'R', 'I', 'F', 'F' });
         FBinaryWriter.Write((int)36);  //Chunksize
            FBinaryWriter.Write(new char[8] {'W','A','V','E','f','m','t',' '}); //format
            FBinaryWriter.Write((int)16); // SubChunk1Size : 16 for PCM
            FBinaryWriter.Write((short)1); //AudioFormat: 1 for PCM
            FBinaryWriter.Write((short)1); // NumChannels: 1 for Mono, 2 for Stereo
            FBinaryWriter.Write((int)22050); //Sample Rate
            FBinaryWriter.Write((int)88200); //Byte Rate
            FBinaryWriter.Write((short)2); //Block Align
            FBinaryWriter.Write((short)16); // Bits per Sample
            FBinaryWriter.Write(new char[4]{'d','a','t','a'});
            FBinaryWriter.Write((int)0); //Data Length: Initialize length to 0;
}

recordStream = Bass.BASS_RecordStart(22050, 1, BASSFlag.BASS_RECORD_PAUSE, myRecordProc, IntPtr.Zero);
i checked the error code after the call and it returned BASS_ERROR_FORMAT

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASS for WinCE
« Reply #126 on: 7 Sep '09 - 16:57 »
BASS_ERROR_FORMAT indicates that the device doesn't support the requested sample format, eg. 22050hz mono 16-bit in your example. Are you able to record in that format on that device with other software? Also, if you call BASS_RecordGetInfo, what "formats" value do you get?

hc_dondon

  • Guest
Re: BASS for WinCE
« Reply #127 on: 7 Sep '09 - 23:04 »
yes, the device has a built in recorder that records wav also. I haven't tried BASS_RecordGetInfo yet. i will try it today. thanks.

hc_dondon

  • Guest
Re: BASS for WinCE
« Reply #128 on: 8 Sep '09 - 03:08 »
Hi, here is the recordgetinfo result on this device. format is WAVE_FORMAT_UNKNOWN
i have tried also making it to 44100 still same result.


hc_dondon

  • Guest
Re: BASS for WinCE
« Reply #129 on: 8 Sep '09 - 03:24 »

this is the sample file details that was recorded using the built-in recorder of the device that doesn't work.


Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASS for WinCE
« Reply #130 on: 8 Sep '09 - 17:45 »
i have tried also making it to 44100 still same result.

Did you also try stereo, ie. 44100hz stereo 16-bit, as in your recording from the built-in recorder?

Code: [Select]
recordStream = Bass.BASS_RecordStart(44100, 2, BASSFlag.BASS_RECORD_PAUSE, myRecordProc, IntPtr.Zero);

hc_dondon

  • Guest
Re: BASS for WinCE
« Reply #131 on: 9 Sep '09 - 10:41 »
@Ian
 i tried it using the info you gave me, it can record and create the file..but when i tried to copy the recorded audio and open it in wavosaur(free audio editing) it has no peaks, i tried to open it through mediaplayer but it just silence.

hc_dondon

  • Guest
Re: BASS for WinCE
« Reply #132 on: 9 Sep '09 - 12:55 »
I tried also to use EncodeWav to create the wav instead of my own waveheader. It can record but i can't hear my voice.
this is the sample output file now but can't hear anything on it.

<a href=http://www.filedropper.com/record><img src=http://www.filedropper.com/download_button.png width=127 height=145 border=0/></a><br /> <div style=font-size:9px;font-family:Arial, Helvetica, sans-serif;width:127px;font-color:#44a854;> <a href=http://www.filedropper.com > FileDropper Free File Hosting</a></div>

pls help.

hc_dondon

  • Guest
Re: BASS for WinCE
« Reply #133 on: 9 Sep '09 - 12:59 »
sorry about the link..here it is. http://www.filedropper.com/record

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASS for WinCE
« Reply #134 on: 9 Sep '09 - 15:04 »
Another user had a similar issue with a particular device, which required some special code to enable recording, so perhaps the built-in recorder is doing something like that on your device. Are you able to capture sound on it with any other 3rd-party software? Btw, I guess the built-in recorder is capturing sound?

Please also post your code, just to be sure there isn't a problem in that.

hc_dondon

  • Guest
Re: BASS for WinCE
« Reply #135 on: 9 Sep '09 - 21:55 »
It is indeed very strange, even the spectrum code, won't show any peaks. When i tried same code in another device it will record and functioning very well. i will try to post my code here. I did not try any third party except from the builtin recorder that the device has provided. I will try to find 3rd party recorder and try it in that device. I also ask for the code from the maker of that device they provided me C++ code but i don't know how to use it. if you want i can email it for you. would you give me email so that i can just email you my code.

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASS for WinCE
« Reply #136 on: 10 Sep '09 - 18:10 »
If the problem also affects the included examples (eg. LIVESPEC and RECTEST), then it isn't something specific to your code, but if you would like me to have a look at the code provided by the device manufacturer, you can upload that here...

   ftp.un4seen.com/incoming/

hc_dondon

  • Guest
Re: BASS for WinCE
« Reply #137 on: 13 Sep '09 - 21:48 »
i have uploaded all files in your ftp: all filenames start with hc_dondon text.

kindly look at it

thanks again.

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASS for WinCE
« Reply #138 on: 14 Sep '09 - 15:24 »
It looks like the device has a "Set_DQ_AudInput" function to set the recording input, but it's in a LIB file and I don't think you can use LIB files directly with .Net? Perhaps, if you ask, they could provide you a DLL to use instead.

hc_dondon

  • Guest
Re: BASS for WinCE
« Reply #139 on: 15 Sep '09 - 09:21 »
It is working great now. :)
I get the dll and use it using dll import

Thanks guys.

thirtyparity

  • Posts: 2
Re: BASS for WinCE
« Reply #140 on: 15 Sep '09 - 19:06 »
What is the best device to use bass with its optimal performance?

simon.chen

  • Posts: 6
Re: BASS for WinCE
« Reply #141 on: 16 Sep '09 - 05:23 »
hi, Ivan

i use BASS_ChannelSetSync method to do something when Play to End. but my SYNCPROC was not called.

private SYNCPROC _mySyncProc;
...
_mySyncProc = new SYNCPROC(MySync);
musicHandle = Bass.BASS_StreamCreateFile(this.mp3FilePath + this.mp3FileName, 0, 0, 0);
if (musicHandle != 0)
{
    if (Bass.BASS_ChannelPlay(musicHandle, true))
   {
         Bass.BASS_ChannelSetSync(musicHandle, BASSSync.BASS_SYNC_END | BASSSync.BASS_SYNC_ONETIME, 0, _mySyncProc, IntPtr.Zero);
    }
}

private void MySync(int syncHandle, int channel, int data, IntPtr user)
{
     ....//
}

and, when it stop itself at the pos 34185544(Total is 34246656), not the end. not only one mp3 file, but also all my mp3 file is stoped at nearly the end, but not the end. so my SYNCPROC cannot be called. Is there any wrong?

EEh

  • Posts: 6
Re: BASS for WinCE
« Reply #142 on: 16 Sep '09 - 11:01 »
It possible to get sound output breaks when WiFi and Bluetooth are turned on at one time.

I suppose, it happens because of playback BASS thread is displaced by threads with higher priority (like WiFi and Bluetooth threads as in our case). Device buffer size increasing (BASS_CONFIG_DEV_BUFFER) does not solve proplem. Also, I was trying to turn off auto-updates in BASS and make my own updates (BASS_ChannelUpdate, BASS_Update) from thread with higher priority value than BASS uses (I set windows ce priority to 128), but sound breaks are still audible.

How can I control and change BASS playback thread priority value? Is it possible to make new config option (BASS_SetConfig)?

OS: Windows Mobile 6.1

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASS for WinCE
« Reply #143 on: 16 Sep '09 - 16:43 »
What is the best device to use bass with its optimal performance?

Are you referring to the CPU used by the device, eg. ARM/MIPS/x86?

i use BASS_ChannelSetSync method to do something when Play to End. but my SYNCPROC was not called.

private SYNCPROC _mySyncProc;
...
_mySyncProc = new SYNCPROC(MySync);
musicHandle = Bass.BASS_StreamCreateFile(this.mp3FilePath + this.mp3FileName, 0, 0, 0);
if (musicHandle != 0)
{
    if (Bass.BASS_ChannelPlay(musicHandle, true))
   {
         Bass.BASS_ChannelSetSync(musicHandle, BASSSync.BASS_SYNC_END | BASSSync.BASS_SYNC_ONETIME, 0, _mySyncProc, IntPtr.Zero);
    }
}

private void MySync(int syncHandle, int channel, int data, IntPtr user)
{
     ....//
}

and, when it stop itself at the pos 34185544(Total is 34246656), not the end. not only one mp3 file, but also all my mp3 file is stoped at nearly the end, but not the end. so my SYNCPROC cannot be called. Is there any wrong?

I tested setting an END sync just now, and it was fine. It shouldn't be file-specific, but if you like, you can upload a troublesome file to try here...

   ftp.un4seen.com/incoming/

Btw, I would recommend setting the sync before starting playback; if the stream is very short, setting the sync afterwards may be too late.

It possible to get sound output breaks when WiFi and Bluetooth are turned on at one time.

I suppose, it happens because of playback BASS thread is displaced by threads with higher priority (like WiFi and Bluetooth threads as in our case). Device buffer size increasing (BASS_CONFIG_DEV_BUFFER) does not solve proplem. Also, I was trying to turn off auto-updates in BASS and make my own updates (BASS_ChannelUpdate, BASS_Update) from thread with higher priority value than BASS uses (I set windows ce priority to 128), but sound breaks are still audible.

How can I control and change BASS playback thread priority value? Is it possible to make new config option (BASS_SetConfig)?

It looks like the device output thread (which mixes the buffers and feeds the device) would be left at default priority when it was intended to be at "time critical". An updated DLL to correct that is in the package now (see 1st post). Let me know if you still have the problem with it, and if so, I'll look into using an even higher priority.

EEh

  • Posts: 6
Re: BASS for WinCE
« Reply #144 on: 17 Sep '09 - 10:53 »
Quote
It looks like the device output thread (which mixes the buffers and feeds the device) would be left at default priority when it was intended to be at "time critical". An updated DLL to correct that is in the package now (see 1st post). Let me know if you still have the problem with it, and if so, I'll look into using an even higher priority.

Hi Ian,

I have tested new updated dll - sound breaks are still exist  (approx. 30 breaks during 10 minutes of playback) :(. Furthermore, I discover a new problem - sometimes sound output does not actually started after BASS_ChannelPlay is called. I.e. after succesfuly called BASS_ChannelPlay() there is no realy playback happens and BASS_ChannelIsActive returns 0. Such behaviour of BASS_ChannelPlay() is new (with earler bass.dll it works fine)- possible it's a bug.

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASS for WinCE
« Reply #145 on: 17 Sep '09 - 15:28 »
I have tested new updated dll - sound breaks are still exist  (approx. 30 breaks during 10 minutes of playback)

Do either of the BASS_CONFIG_BUFFER and BASS_CONFIG_DEV_BUFFER settings make any difference with the updated DLL?

Do you happen to know what priority the WiFi/Bluetooth threads on your device are running at? Perhaps the problem is that they are running at a higher priority than the audio driver? Do you get the breaks in playback with any other software? If you haven't already done so, please also try to reproduce the problem with the pre-compiled examples.

Furthermore, I discover a new problem - sometimes sound output does not actually started after BASS_ChannelPlay is called. I.e. after succesfuly called BASS_ChannelPlay() there is no realy playback happens and BASS_ChannelIsActive returns 0. Such behaviour of BASS_ChannelPlay() is new (with earler bass.dll it works fine)- possible it's a bug.

That's strange, as the only change in the update was the thread priority, which shouldn't affect that stuff. Is there any pattern to the problem, eg. a particular file or length of file? Also, is the BASS_ChannelPlay call always successful, ie. returning TRUE?

If you could create a small example to reproduce the problem with, that would be most useful.

simon.chen

  • Posts: 6
Re: BASS for WinCE
« Reply #146 on: 18 Sep '09 - 07:27 »
i use BASS_ChannelSetSync method to do something when Play to End. but my SYNCPROC was not called.

private SYNCPROC _mySyncProc;
...
_mySyncProc = new SYNCPROC(MySync);
musicHandle = Bass.BASS_StreamCreateFile(this.mp3FilePath + this.mp3FileName, 0, 0, 0);
if (musicHandle != 0)
{
    if (Bass.BASS_ChannelPlay(musicHandle, true))
   {
         Bass.BASS_ChannelSetSync(musicHandle, BASSSync.BASS_SYNC_END | BASSSync.BASS_SYNC_ONETIME, 0, _mySyncProc, IntPtr.Zero);
    }
}

private void MySync(int syncHandle, int channel, int data, IntPtr user)
{
     ....//
}

and, when it stop itself at the pos 34185544(Total is 34246656), not the end. not only one mp3 file, but also all my mp3 file is stoped at nearly the end, but not the end. so my SYNCPROC cannot be called. Is there any wrong?

I tested setting an END sync just now, and it was fine. It shouldn't be file-specific, but if you like, you can upload a troublesome file to try here...

   ftp.un4seen.com/incoming/

Btw, I would recommend setting the sync before starting playback; if the stream is very short, setting the sync afterwards may be too late.
[/quote]

it was fine to get a END sync, but in the MySync, if i do some UI update, the Procedure Losing Control(debug step by step, but the process state turn into running state and not extcute the next statement), so i use the Invoke() method to do UI update, it work fine now.

radio42

  • Posts: 4576
Re: BASS for WinCE
« Reply #147 on: 18 Sep '09 - 07:36 »
Yes, that is totally normal.
The SYNCPROC will always execute in a thread created by BASS and not in your UI thread.
But any UI updates must be executed in the main UI thread...so you need to call Invoke/BeginInvoke in order to ensure you are back on the UI thread.

Bergamin

  • Posts: 3
BASS for WinCE
« Reply #148 on: 22 Sep '09 - 14:01 »
Hi,

When I run the following command line with the BassNet.Compact :
Code: [Select]
BassEnc.BASS_Encode_Start(streamRec, "output.wav", BASSEncode.BASS_ENCODE_PCM, null, IntPtr.Zero);Return a message :
This application requires a newer version of the Microsoft® .NET Compact Framework than the version installed on this device.


radio42

  • Posts: 4576
Re: BASS for WinCE
« Reply #149 on: 22 Sep '09 - 14:08 »
Yep, that indicated, that you have only the .Net compact framework 1.1 installed on the device.
But BASS.Net compact requires the .Net compact framework 2.0 to be installed ;-)